@Override public PointValues.Relation compare(byte[] minPackedValue, byte[] maxPackedValue) { if ((upperPointQuery != null && StringHelper.compare(bytesPerDim, minPackedValue, 0, upperPointQuery, 0) > 0) || (lowerPointQuery != null && StringHelper.compare(bytesPerDim, maxPackedValue, 0, lowerPointQuery, 0) < 0)) { // does not match the query return PointValues.Relation.CELL_OUTSIDE_QUERY; } // check the current bounds if (lowerBucket != Long.MIN_VALUE) { long maxBucket = bucketFunction.applyAsLong(maxPackedValue); if (maxBucket < lowerBucket) { return PointValues.Relation.CELL_OUTSIDE_QUERY; } } if (upperBucket != Long.MAX_VALUE) { long minBucket = bucketFunction.applyAsLong(minPackedValue); if (minBucket > upperBucket) { return PointValues.Relation.CELL_OUTSIDE_QUERY; } } return PointValues.Relation.CELL_CROSSES_QUERY; }
@Override public PointValues.Relation compare(byte[] minPackedValue, byte[] maxPackedValue) { if ((upperPointQuery != null && StringHelper.compare(bytesPerDim, minPackedValue, 0, upperPointQuery, 0) > 0) || (lowerPointQuery != null && StringHelper.compare(bytesPerDim, maxPackedValue, 0, lowerPointQuery, 0) < 0)) { // does not match the query return PointValues.Relation.CELL_OUTSIDE_QUERY; } // check the current bounds if (lowerBucket != Long.MIN_VALUE) { long maxBucket = bucketFunction.applyAsLong(maxPackedValue); if (maxBucket < lowerBucket) { return PointValues.Relation.CELL_OUTSIDE_QUERY; } } if (upperBucket != Long.MAX_VALUE) { long minBucket = bucketFunction.applyAsLong(minPackedValue); if (minBucket > upperBucket) { return PointValues.Relation.CELL_OUTSIDE_QUERY; } } return PointValues.Relation.CELL_CROSSES_QUERY; }
@Override public PointValues.Relation compare(byte[] minPackedValue, byte[] maxPackedValue) { if ((upperPointQuery != null && StringHelper.compare(bytesPerDim, minPackedValue, 0, upperPointQuery, 0) > 0) || (lowerPointQuery != null && StringHelper.compare(bytesPerDim, maxPackedValue, 0, lowerPointQuery, 0) < 0)) { // does not match the query return PointValues.Relation.CELL_OUTSIDE_QUERY; } // check the current bounds if (lowerBucket != Long.MIN_VALUE) { long maxBucket = bucketFunction.applyAsLong(maxPackedValue); if (maxBucket < lowerBucket) { return PointValues.Relation.CELL_OUTSIDE_QUERY; } } if (upperBucket != Long.MAX_VALUE) { long minBucket = bucketFunction.applyAsLong(minPackedValue); if (minBucket > upperBucket) { return PointValues.Relation.CELL_OUTSIDE_QUERY; } } return PointValues.Relation.CELL_CROSSES_QUERY; }
@Override public int compare(InetAddress o1, InetAddress o2) { byte[] b1 = InetAddressPoint.encode(o1); byte[] b2 = InetAddressPoint.encode(o2); return StringHelper.compare(b1.length, b1, 0, b2, 0); }
@Override public int compare(InetAddress o1, InetAddress o2) { byte[] b1 = InetAddressPoint.encode(o1); byte[] b2 = InetAddressPoint.encode(o2); return StringHelper.compare(b1.length, b1, 0, b2, 0); }