Codota Logo
DataUtils.checkArgument
Code IndexAdd Codota to your IDE (free)

How to use
checkArgument
method
in
org.h2.mvstore.DataUtils

Best Java code snippets using org.h2.mvstore.DataUtils.checkArgument (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: com.h2database/h2

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;
}
origin: com.h2database/h2

/**
 * 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;
}
origin: com.h2database/h2

/**
 * 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);
}
origin: com.h2database/h2

/**
 * 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);
}
origin: com.h2database/h2

/**
 * 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);
    }
  }
}
origin: com.h2database/h2

/**
 * Create a new cache with the given memory size.
 *
 * @param config the configuration
 */
@SuppressWarnings("unchecked")
public CacheLongKeyLIRS(Config config) {
  setMaxMemory(config.maxMemory);
  this.nonResidentQueueSize = config.nonResidentQueueSize;
  DataUtils.checkArgument(
      Integer.bitCount(config.segmentCount) == 1,
      "The segment count must be a power of 2, is {0}", config.segmentCount);
  this.segmentCount = config.segmentCount;
  this.segmentMask = segmentCount - 1;
  this.stackMoveDistance = config.stackMoveDistance;
  segments = new Segment[segmentCount];
  clear();
  // use the high bits for the segment
  this.segmentShift = 32 - Integer.bitCount(segmentMask);
}
origin: com.h2database/h2

/**
 * 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(0L, value);
  VersionedValue oldValue = map.put(key, newValue);
  return (V) (oldValue == null ? null : oldValue.value);
}
origin: com.h2database/h2

private MVMap<String, String> getMetaMap(long version) {
  Chunk c = getChunkForVersion(version);
  DataUtils.checkArgument(c != null, "Unknown version {0}", version);
  c = readChunkHeader(c.block);
  MVMap<String, String> oldMeta = meta.openReadOnly();
  oldMeta.setRootPos(c.metaRootPos, version);
  return oldMeta;
}
origin: com.h2database/h2

private Set<Integer> collectReferencedChunks() {
  long testVersion = lastChunk.version;
  DataUtils.checkArgument(testVersion > 0, "Collect references on version 0");
  long readCount = getFileStore().readCount.get();
  Set<Integer> referenced = new HashSet<>();
  for (Cursor<String, String> c = meta.cursor("root."); c.hasNext();) {
    String key = c.next();
    if (!key.startsWith("root.")) {
      break;
    }
    long pos = DataUtils.parseHexLong(c.getValue());
    if (pos == 0) {
      continue;
    }
    int mapId = DataUtils.parseHexInt(key.substring("root.".length()));
    collectReferencedChunks(referenced, mapId, pos, 0);
  }
  long pos = lastChunk.metaRootPos;
  collectReferencedChunks(referenced, 0, pos, 0);
  readCount = fileStore.readCount.get() - readCount;
  return referenced;
}
origin: com.h2database/h2

/**
 * Rename a map.
 *
 * @param map the map
 * @param newName the new name
 */
public synchronized void renameMap(MVMap<?, ?> map, String newName) {
  checkOpen();
  DataUtils.checkArgument(map != meta,
      "Renaming the meta map is not allowed");
  int id = map.getId();
  String oldName = getMapName(id);
  if (oldName.equals(newName)) {
    return;
  }
  DataUtils.checkArgument(
      !meta.containsKey("name." + newName),
      "A map named {0} already exists", newName);
  markMetaChanged();
  String x = Integer.toHexString(id);
  meta.remove("name." + oldName);
  meta.put(MVMap.getMapKey(id), map.asString(newName));
  meta.put("name." + newName, x);
}
origin: com.h2database/h2

/**
 * Add or replace a key-value pair.
 *
 * @param key the key (may not be null)
 * @param value the value (may not be null)
 * @return the old value if the key existed, or null otherwise
 */
@Override
@SuppressWarnings("unchecked")
public synchronized V put(K key, V value) {
  DataUtils.checkArgument(value != null, "The value may not be null");
  beforeWrite();
  long v = writeVersion;
  Page p = root.copy(v);
  p = splitRootIfNeeded(p, v);
  Object result = put(p, v, key, value);
  newRoot(p);
  return (V) result;
}
origin: com.h2database/h2

  return;
DataUtils.checkArgument(
    isKnownVersion(version),
    "Unknown version {0}", version);
origin: com.h2database/h2

/**
 * Remove a map. Please note rolling back this operation does not restore
 * the data; if you need this ability, use Map.clear().
 *
 * @param map the map to remove
 */
public synchronized void removeMap(MVMap<?, ?> map) {
  checkOpen();
  DataUtils.checkArgument(map != meta,
      "Removing the meta map is not allowed");
  map.clear();
  int id = map.getId();
  String name = getMapName(id);
  markMetaChanged();
  meta.remove(MVMap.getMapKey(id));
  meta.remove("name." + name);
  meta.remove(MVMap.getMapRootKey(id));
  maps.remove(id);
}
origin: com.h2database/h2

      "the method on the writable map");
DataUtils.checkArgument(version >= createVersion,
    "Unknown version {0}; this map was created in version is {1}",
    version, createVersion);
origin: com.h2database/h2-mvstore

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;
}
origin: org.wowtools/h2

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;
}
origin: com.eventsourcing/h2

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;
}
origin: com.eventsourcing/h2

private MVMap<String, String> getMetaMap(long version) {
  Chunk c = getChunkForVersion(version);
  DataUtils.checkArgument(c != null, "Unknown version {0}", version);
  c = readChunkHeader(c.block);
  MVMap<String, String> oldMeta = meta.openReadOnly();
  oldMeta.setRootPos(c.metaRootPos, version);
  return oldMeta;
}
origin: com.h2database/h2-mvstore

private MVMap<String, String> getMetaMap(long version) {
  Chunk c = getChunkForVersion(version);
  DataUtils.checkArgument(c != null, "Unknown version {0}", version);
  c = readChunkHeader(c.block);
  MVMap<String, String> oldMeta = meta.openReadOnly();
  oldMeta.setRootPos(c.metaRootPos, version);
  return oldMeta;
}
origin: org.wowtools/h2

private MVMap<String, String> getMetaMap(long version) {
  Chunk c = getChunkForVersion(version);
  DataUtils.checkArgument(c != null, "Unknown version {0}", version);
  c = readChunkHeader(c.block);
  MVMap<String, String> oldMeta = meta.openReadOnly();
  oldMeta.setRootPos(c.metaRootPos, version);
  return oldMeta;
}
org.h2.mvstoreDataUtilscheckArgument

Javadoc

Throw an IllegalArgumentException if the argument is invalid.

Popular methods of DataUtils

  • readVarInt
    Read a variable size int.
  • appendMap
    Append a map to the string builder, sorted by key.
  • copyExcept
    Copy the elements of an array, and remove one element.
  • copyWithGap
    Copy the elements of an array, with a gap.
  • encodeLength
    Convert the length to a length code 0..31. 31 means more than 1 MB.
  • formatMessage
    Format an error message.
  • getCheckValue
    Calculate a check value for the given integer. A check value is mean to verify the data is consisten
  • getErrorCode
    Get the error code from an exception message.
  • getFletcher32
    Calculate the Fletcher32 checksum.
  • getPageChunkId
    Get the chunk id from the position.
  • getPageMaxLength
    Get the maximum length for the given code. For the code 31, PAGE_LARGE is returned.
  • getPageOffset
    Get the offset from the position.
  • getPageMaxLength,
  • getPageOffset,
  • getPagePos,
  • getPageType,
  • getVarIntLen,
  • initCause,
  • newIllegalArgumentException,
  • newIllegalStateException,
  • newUnsupportedOperationException

Popular in Java

  • Running tasks concurrently on multiple threads
  • setScale (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now