/** * Check whether two spatial values are equal. * * @param a the first value * @param b the second value * @return true if they are equal */ public boolean equals(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } long la = ((SpatialKey) a).getId(); long lb = ((SpatialKey) b).getId(); return la == lb; }
@Override public Row get() { return table.getRow(session, current.getId()); }
/** * Get the row with the given index key. * * @param key the index key * @return the row */ SearchRow getRow(SpatialKey key) { SearchRow searchRow = mvTable.getTemplateRow(); searchRow.setKey(key.getId()); return searchRow; }
@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()); }
/** * Check whether two spatial values are equal. * * @param a the first value * @param b the second value * @return true if they are equal */ public boolean equals(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } long la = ((SpatialKey) a).getId(); long lb = ((SpatialKey) b).getId(); return la == lb; }
/** * Check whether two spatial values are equal. * * @param a the first value * @param b the second value * @return true if they are equal */ public boolean equals(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } long la = ((SpatialKey) a).getId(); long lb = ((SpatialKey) b).getId(); return la == lb; }
/** * Check whether two spatial values are equal. * * @param a the first value * @param b the second value * @return true if they are equal */ public boolean equals(Object a, Object b) { if (a == b) { return true; } else if (a == null || b == null) { return false; } long la = ((SpatialKey) a).getId(); long lb = ((SpatialKey) b).getId(); return la == lb; }
@Override public Row get() { return table.getRow(session, current.getId()); }
@Override public Row get() { return table.getRow(session, current.getId()); }
/** * @param i Spatial key iterator. * @return Iterator over rows. */ private Iterator<GridH2Row> rowIterator(Iterator<SpatialKey> i) { if (!i.hasNext()) return Collections.emptyIterator(); List<GridH2Row> rows = new ArrayList<>(); do { GridH2Row row = idToRow.get(i.next().getId()); assert row != null; rows.add(row); } while (i.hasNext()); return filter(rows.iterator()); }
/** * Get the row with the given index key. * * @param key the index key * @return the row */ SearchRow getRow(SpatialKey key) { SearchRow searchRow = mvTable.getTemplateRow(); searchRow.setKey(key.getId()); return searchRow; }
/** * Get the row with the given index key. * * @param key the index key * @return the row */ SearchRow getRow(SpatialKey key) { SearchRow searchRow = mvTable.getTemplateRow(); searchRow.setKey(key.getId()); return searchRow; }
@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()); }
@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()); }
@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()); }