Codota Logo
SpatialKey.isNull
Code IndexAdd Codota to your IDE (free)

How to use
isNull
method
in
org.h2.mvstore.rtree.SpatialKey

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

  • Common ways to obtain SpatialKey
private void myMethod () {
SpatialKey s =
  • Codota IconPage page;(SpatialKey) page.getKey(pos.index++)
  • Codota IconSearchRow searchRow;new SpatialKey(searchRow.getKey())
  • Codota IconArrayList arrayList;(SpatialKey) arrayList.get(index)
  • Smart code suggestions by Codota
}
origin: com.h2database/h2

private static ArrayList<Object> getNotNull(ArrayList<Object> list) {
  ArrayList<Object> result = null;
  for (Object o : list) {
    SpatialKey a = (SpatialKey) o;
    if (a.isNull()) {
      result = New.arrayList();
      break;
    }
  }
  if (result == null) {
    return list;
  }
  for (Object o : list) {
    SpatialKey a = (SpatialKey) o;
    if (!a.isNull()) {
      result.add(a);
    }
  }
  return result;
}
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

/**
 * Check whether a is completely inside b and does not touch the
 * given bound.
 *
 * @param objA the object to check
 * @param objB the bounds
 * @return true if a is completely inside b
 */
public boolean isInside(Object objA, Object objB) {
  SpatialKey a = (SpatialKey) objA;
  SpatialKey b = (SpatialKey) objB;
  if (a.isNull() || b.isNull()) {
    return false;
  }
  for (int i = 0; i < dimensions; i++) {
    if (a.min(i) <= b.min(i) || a.max(i) >= b.max(i)) {
      return false;
    }
  }
  return true;
}
origin: com.h2database/h2

/**
 * Increase the bounds in the given spatial object.
 *
 * @param bounds the bounds (may be modified)
 * @param add the value
 */
public void increaseBounds(Object bounds, Object add) {
  SpatialKey a = (SpatialKey) add;
  SpatialKey b = (SpatialKey) bounds;
  if (a.isNull() || b.isNull()) {
    return;
  }
  for (int i = 0; i < dimensions; i++) {
    b.setMin(i, Math.min(b.min(i), a.min(i)));
    b.setMax(i, Math.max(b.max(i), a.max(i)));
  }
}
origin: com.h2database/h2

/**
 * Check whether the two objects overlap.
 *
 * @param objA the first object
 * @param objB the second object
 * @return true if they overlap
 */
public boolean isOverlap(Object objA, Object objB) {
  SpatialKey a = (SpatialKey) objA;
  SpatialKey b = (SpatialKey) objB;
  if (a.isNull() || b.isNull()) {
    return false;
  }
  for (int i = 0; i < dimensions; i++) {
    if (a.max(i) < b.min(i) || a.min(i) > b.max(i)) {
      return false;
    }
  }
  return true;
}
origin: com.h2database/h2

/**
 * Check whether a contains b.
 *
 * @param objA the bounding box
 * @param objB the object
 * @return the area
 */
public boolean contains(Object objA, Object objB) {
  SpatialKey a = (SpatialKey) objA;
  SpatialKey b = (SpatialKey) objB;
  if (a.isNull() || b.isNull()) {
    return false;
  }
  for (int i = 0; i < dimensions; i++) {
    if (a.min(i) > b.min(i) || a.max(i) < b.max(i)) {
      return false;
    }
  }
  return true;
}
origin: com.h2database/h2

/**
 * Get the combined area of both objects.
 *
 * @param objA the first object
 * @param objB the second object
 * @return the area
 */
float getCombinedArea(Object objA, Object objB) {
  SpatialKey a = (SpatialKey) objA;
  SpatialKey b = (SpatialKey) objB;
  if (a.isNull()) {
    return getArea(b);
  } else if (b.isNull()) {
    return getArea(a);
  }
  float area = 1;
  for (int i = 0; i < dimensions; i++) {
    float min = Math.min(a.min(i),  b.min(i));
    float max = Math.max(a.max(i),  b.max(i));
    area *= max - min;
  }
  return area;
}
origin: com.h2database/h2

/**
 * Get the area increase by extending a to contain b.
 *
 * @param objA the bounding box
 * @param objB the object
 * @return the area
 */
public float getAreaIncrease(Object objA, Object objB) {
  SpatialKey b = (SpatialKey) objB;
  SpatialKey a = (SpatialKey) objA;
  if (a.isNull() || b.isNull()) {
    return 0;
  }
  float min = a.min(0);
  float max = a.max(0);
  float areaOld = max - min;
  min = Math.min(min,  b.min(0));
  max = Math.max(max,  b.max(0));
  float areaNew = max - min;
  for (int i = 1; i < dimensions; i++) {
    min = a.min(i);
    max = a.max(i);
    areaOld *= max - min;
    min = Math.min(min,  b.min(i));
    max = Math.max(max,  b.max(i));
    areaNew *= max - min;
  }
  return areaNew - areaOld;
}
origin: com.h2database/h2

/**
 * Create a bounding box starting with the given object.
 *
 * @param objA the object
 * @return the bounding box
 */
Object createBoundingBox(Object objA) {
  SpatialKey a = (SpatialKey) objA;
  if (a.isNull()) {
    return a;
  }
  float[] minMax = new float[dimensions * 2];
  for (int i = 0; i < dimensions; i++) {
    minMax[i + i] = a.min(i);
    minMax[i + i + 1] = a.max(i);
  }
  return new SpatialKey(0, minMax);
}
origin: com.h2database/h2

@Override
public void remove(Session session, Row row) {
  SpatialKey key = getKey(row);
  if (key.isNull()) {
    return;
  }
  TransactionMap<SpatialKey, Value> map = getMap(session);
  try {
    Value old = map.remove(key);
    if (old == null) {
      old = map.remove(key);
      throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1,
          getSQL() + ": " + row.getKey());
    }
  } catch (IllegalStateException e) {
    throw mvTable.convertException(e);
  }
}
origin: com.h2database/h2

SpatialKey key = getKey(row);
if (key.isNull()) {
  return;
origin: com.h2database/h2

@Override
public void write(WriteBuffer buff, Object obj) {
  SpatialKey k = (SpatialKey) obj;
  if (k.isNull()) {
    buff.putVarInt(-1);
    buff.putVarLong(k.getId());
    return;
  }
  int flags = 0;
  for (int i = 0; i < dimensions; i++) {
    if (k.min(i) == k.max(i)) {
      flags |= 1 << i;
    }
  }
  buff.putVarInt(flags);
  for (int i = 0; i < dimensions; i++) {
    buff.putFloat(k.min(i));
    if ((flags & (1 << i)) == 0) {
      buff.putFloat(k.max(i));
    }
  }
  buff.putVarLong(k.getId());
}
origin: com.h2database/h2-mvstore

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: org.wowtools/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.eventsourcing/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-mvstore

/**
 * Increase the bounds in the given spatial object.
 *
 * @param bounds the bounds (may be modified)
 * @param add the value
 */
public void increaseBounds(Object bounds, Object add) {
  SpatialKey a = (SpatialKey) add;
  SpatialKey b = (SpatialKey) bounds;
  if (a.isNull() || b.isNull()) {
    return;
  }
  for (int i = 0; i < dimensions; i++) {
    b.setMin(i, Math.min(b.min(i), a.min(i)));
    b.setMax(i, Math.max(b.max(i), a.max(i)));
  }
}
origin: org.wowtools/h2

/**
 * Increase the bounds in the given spatial object.
 *
 * @param bounds the bounds (may be modified)
 * @param add the value
 */
public void increaseBounds(Object bounds, Object add) {
  SpatialKey a = (SpatialKey) add;
  SpatialKey b = (SpatialKey) bounds;
  if (a.isNull() || b.isNull()) {
    return;
  }
  for (int i = 0; i < dimensions; i++) {
    b.setMin(i, Math.min(b.min(i), a.min(i)));
    b.setMax(i, Math.max(b.max(i), a.max(i)));
  }
}
origin: com.eventsourcing/h2

/**
 * Increase the bounds in the given spatial object.
 *
 * @param bounds the bounds (may be modified)
 * @param add the value
 */
public void increaseBounds(Object bounds, Object add) {
  SpatialKey a = (SpatialKey) add;
  SpatialKey b = (SpatialKey) bounds;
  if (a.isNull() || b.isNull()) {
    return;
  }
  for (int i = 0; i < dimensions; i++) {
    b.setMin(i, Math.min(b.min(i), a.min(i)));
    b.setMax(i, Math.max(b.max(i), a.max(i)));
  }
}
origin: com.eventsourcing/h2

/**
 * Create a bounding box starting with the given object.
 *
 * @param objA the object
 * @return the bounding box
 */
Object createBoundingBox(Object objA) {
  SpatialKey a = (SpatialKey) objA;
  if (a.isNull()) {
    return a;
  }
  float[] minMax = new float[dimensions * 2];
  for (int i = 0; i < dimensions; i++) {
    minMax[i + i] = a.min(i);
    minMax[i + i + 1] = a.max(i);
  }
  return new SpatialKey(0, minMax);
}
origin: org.wowtools/h2

@Override
public void remove(Session session, Row row) {
  SpatialKey key = getKey(row);
  
  if (key.isNull()) {
    return;
  }
  
  TransactionMap<SpatialKey, Value> map = getMap(session);
  try {
    Value old = map.remove(key);
    if (old == null) {
      old = map.remove(key);
      throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1,
          getSQL() + ": " + row.getKey());
    }
  } catch (IllegalStateException e) {
    throw mvTable.convertException(e);
  }
}
org.h2.mvstore.rtreeSpatialKeyisNull

Popular methods of SpatialKey

  • <init>
    Create a new key.
  • getId
  • equalsIgnoringId
    Check whether two objects are equals, but do not compare the id fields.
  • max
    Get the maximum value for the given dimension.
  • min
    Get the minimum value for the given dimension.
  • setMax
    Set the maximum value for the given dimension.
  • setMin
    Set the minimum value for the given dimension.
  • toString

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • setContentView (Activity)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JButton (javax.swing)
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