congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.h2.mvstore.rtree
Code IndexAdd Tabnine to your IDE (free)

How to use org.h2.mvstore.rtree

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

origin: com.h2database/h2

public MVRTreeMap(int dimensions, DataType valueType) {
  super(new SpatialDataType(dimensions), valueType);
  this.keyType = (SpatialDataType) getKeyType();
}
origin: com.h2database/h2

@Override
public SpatialKey next() {
  if (!hasNext()) {
    return null;
  }
  SpatialKey c = current;
  fetchNext();
  return c;
}
origin: com.h2database/h2

private SpatialDataType getSpatialDataType() {
  if (spatialType == null) {
    spatialType = new SpatialDataType(2);
  }
  return spatialType;
}
origin: com.h2database/h2

private float getArea(SpatialKey a) {
  if (a.isNull()) {
    return 0;
  }
  float area = 1;
  for (int i = 0; i < dimensions; i++) {
    area *= a.max(i) - a.min(i);
  }
  return area;
}
origin: com.h2database/h2

private Page split(Page p, long writeVersion) {
  return quadraticSplit ?
      splitQuadratic(p, writeVersion) :
      splitLinear(p, writeVersion);
}
origin: com.h2database/h2

  @Override
  protected boolean check(boolean leaf, SpatialKey key,
      SpatialKey test) {
    if (leaf) {
      return keyType.isInside(key, test);
    }
    return keyType.isOverlap(key, test);
  }
};
origin: com.h2database/h2

@Override
@SuppressWarnings("unchecked")
public V put(SpatialKey key, V value) {
  return (V) putOrAdd(key, value, false);
}
origin: com.h2database/h2

/**
 * Create a new map with the given dimensions and value type.
 *
 * @param <V> the value type
 * @param dimensions the number of dimensions
 * @param valueType the value type
 * @return the map
 */
public static <V> MVRTreeMap<V> create(int dimensions, DataType valueType) {
  return new MVRTreeMap<>(dimensions, valueType);
}
origin: com.h2database/h2

  @Override
  protected boolean check(boolean leaf, SpatialKey key,
      SpatialKey test) {
    return keyType.isOverlap(key, test);
  }
};
origin: com.h2database/h2

@Override
public void read(ByteBuffer buff, Object[] obj, int len, boolean key) {
  for (int i = 0; i < len; i++) {
    obj[i] = read(buff);
  }
}
origin: com.h2database/h2

@Override
public void write(WriteBuffer buff, Object[] obj, int len, boolean key) {
  for (int i = 0; i < len; i++) {
    write(buff, obj[i]);
  }
}
origin: com.h2database/h2

@Override
@SuppressWarnings("unchecked")
public V get(Object key) {
  return (V) get(root, key);
}
origin: com.h2database/h2

@Override
public boolean equals(Object other) {
  if (other == this) {
    return true;
  } else if (!(other instanceof SpatialKey)) {
    return false;
  }
  SpatialKey o = (SpatialKey) other;
  if (id != o.id) {
    return false;
  }
  return equalsIgnoringId(o);
}
origin: com.h2database/h2

@Override
public boolean hasNext() {
  if (!initialized) {
    // init
    pos = new CursorPos(root, 0, null);
    fetchNext();
    initialized = true;
  }
  return current != null;
}
origin: com.h2database/h2

@Override
public long getRowCount(Session session) {
  return treeMap.sizeAsLong();
}
origin: com.h2database/h2

@Override
public void truncate(Session session) {
  treeMap.clear();
}
origin: com.h2database/h2

@Override
public int getMemory(Object obj) {
  if (obj instanceof SpatialKey) {
    return getSpatialDataType().getMemory(obj);
  }
  return getMemory((Value) obj);
}
origin: com.h2database/h2

/**
 * Skip over that many entries. This method is relatively fast (for this
 * map implementation) even if many entries need to be skipped.
 *
 * @param n the number of entries to skip
 */
public void skip(long n) {
  while (hasNext() && n-- > 0) {
    fetchNext();
  }
}
origin: com.h2database/h2

/**
 * Add a given key-value pair. The key should not exist (if it exists, the
 * result is undefined).
 *
 * @param key the key
 * @param value the value
 */
public void add(SpatialKey key, V value) {
  putOrAdd(key, value, true);
}
origin: com.h2database/h2

@Override
public long getRowCountApproximation() {
  return treeMap.sizeAsLong();
}
org.h2.mvstore.rtree

Most used classes

  • MVRTreeMap
    An r-tree implementation. It supports both the linear and the quadratic split algorithm.
  • SpatialKey
    A unique spatial key.
  • MVRTreeMap$Builder
    A builder for this class.
  • MVRTreeMap$RTreeCursor
    A cursor to iterate over a subset of the keys.
  • SpatialDataType
    A spatial data type. This class supports up to 31 dimensions. Each dimension can have a minimum and
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now