当前位置: 首页>>代码示例>>Java>>正文


Java DataUtils.checkArgument方法代码示例

本文整理汇总了Java中org.h2.mvstore.DataUtils.checkArgument方法的典型用法代码示例。如果您正苦于以下问题:Java DataUtils.checkArgument方法的具体用法?Java DataUtils.checkArgument怎么用?Java DataUtils.checkArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.h2.mvstore.DataUtils的用法示例。


在下文中一共展示了DataUtils.checkArgument方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CacheLongKeyLIRS

import org.h2.mvstore.DataUtils; //导入方法依赖的package包/类
/**
 * Create a new cache with the given memory size.
 *
 * @param maxMemory the maximum memory to use (1 or larger)
 * @param segmentCount the number of cache segments (must be a power of 2)
 * @param stackMoveDistance how many other item are to be moved to the top
 *        of the stack before the current item is moved
 */
@SuppressWarnings("unchecked")
public CacheLongKeyLIRS(long maxMemory,
        int segmentCount, int stackMoveDistance) {
    setMaxMemory(maxMemory);
    DataUtils.checkArgument(
            Integer.bitCount(segmentCount) == 1,
            "The segment count must be a power of 2, is {0}", segmentCount);
    this.segmentCount = segmentCount;
    this.segmentMask = segmentCount - 1;
    this.stackMoveDistance = stackMoveDistance;
    segments = new Segment[segmentCount];
    clear();
    // use the high bits for the segment
    this.segmentShift = 32 - Integer.bitCount(segmentMask);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:24,代码来源:CacheLongKeyLIRS.java

示例2: SpatialDataType

import org.h2.mvstore.DataUtils; //导入方法依赖的package包/类
public SpatialDataType(int dimensions) {
    // Because of how we are storing the
    // min-max-flag in the read/write method
    // the number of dimensions must be < 32.
    DataUtils.checkArgument(
            dimensions >= 1 && dimensions < 32,
            "Dimensions must be between 1 and 31, is {0}", dimensions);
    this.dimensions = dimensions;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:10,代码来源:SpatialDataType.java

示例3: getOperationId

import org.h2.mvstore.DataUtils; //导入方法依赖的package包/类
/**
 * Combine the transaction id and the log id to an operation id.
 *
 * @param transactionId the transaction id
 * @param logId the log id
 * @return the operation id
 */
static long getOperationId(int transactionId, long logId) {
    DataUtils.checkArgument(transactionId >= 0 && transactionId < (1 << 24),
            "Transaction id out of range: {0}", transactionId);
    DataUtils.checkArgument(logId >= 0 && logId < (1L << 40),
            "Transaction log id out of range: {0}", logId);
    return ((long) transactionId << 40) | logId;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:15,代码来源:TransactionStore.java

示例4: putCommitted

import org.h2.mvstore.DataUtils; //导入方法依赖的package包/类
/**
 * Update the value for the given key, without adding an undo log entry.
 *
 * @param key the key
 * @param value the value
 * @return the old value
 */
@SuppressWarnings("unchecked")
public V putCommitted(K key, V value) {
    DataUtils.checkArgument(value != null, "The value may not be null");
    VersionedValue newValue = new VersionedValue();
    newValue.value = value;
    VersionedValue oldValue = map.put(key, newValue);
    return (V) (oldValue == null ? null : oldValue.value);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:16,代码来源:TransactionStore.java

示例5: setMaxMemory

import org.h2.mvstore.DataUtils; //导入方法依赖的package包/类
/**
 * Set the maximum memory this cache should use. This will not
 * immediately cause entries to get removed however; it will only change
 * the limit. To resize the internal array, call the clear method.
 *
 * @param maxMemory the maximum size (1 or larger) in bytes
 */
public void setMaxMemory(long maxMemory) {
    DataUtils.checkArgument(
            maxMemory > 0,
            "Max memory must be larger than 0, is {0}", maxMemory);
    this.maxMemory = maxMemory;
    if (segments != null) {
        long max = 1 + maxMemory / segments.length;
        for (Segment<V> s : segments) {
            s.setMaxMemory(max);
        }
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:20,代码来源:CacheLongKeyLIRS.java

示例6: put

import org.h2.mvstore.DataUtils; //导入方法依赖的package包/类
/**
 * Update the value for the given key.
 * <p>
 * If the row is locked, this method will retry until the row could be
 * updated or until a lock timeout.
 *
 * @param key the key
 * @param value the new value (not null)
 * @return the old value
 * @throws IllegalStateException if a lock timeout occurs
 */
public V put(K key, V value) {
    DataUtils.checkArgument(value != null, "The value may not be null");
    return set(key, value);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:16,代码来源:TransactionStore.java

示例7: tryPut

import org.h2.mvstore.DataUtils; //导入方法依赖的package包/类
/**
 * Try to update the value for the given key.
 * <p>
 * This will fail if the row is locked by another transaction (that
 * means, if another open transaction changed the row).
 *
 * @param key the key
 * @param value the new value
 * @return whether the entry could be updated
 */
public boolean tryPut(K key, V value) {
    DataUtils.checkArgument(value != null, "The value may not be null");
    return trySet(key, value, false);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:15,代码来源:TransactionStore.java


注:本文中的org.h2.mvstore.DataUtils.checkArgument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。