本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}