@Test public void testIndex() { final double[] values = {42, 43, 57, 59}; Assert.assertNotNull(createSFC().getId(values)); }
@Override public byte[] getId(double[] values) { if (values.length == dimensionCount) { int boxCount = 0; final double[] boxedValues = new double[dimensionCount * 2]; for (int i = 0; i < dimensionCount; i++) { boxedValues[boxCount++] = values[i]; boxedValues[boxCount++] = values[i]; } values = boxedValues; } if (values.length != (dimensionCount * 2)) { LOGGER.error( "Point or bounding box value count does not match number of indexed dimensions."); return null; } normalize(values); double maxDim = 0.0; for (int i = 0; (i + 1) < values.length; i++) { maxDim = Math.max(maxDim, Math.abs(values[i] - values[++i])); } final int l1 = (int) Math.floor(Math.log(maxDim) / LOG_POINT_FIVE); int length = g; if (l1 < g) { final double w2 = Math.pow(0.5, l1 + 1); length = l1 + 1; for (int i = 0; (i + 1) < values.length; i++) { if (!predicate(values[i], values[++i], w2)) { length = l1; break; } } } final double[] minValues = new double[values.length / 2]; for (int i = 0; (i + 1) < values.length; i += 2) { minValues[i / 2] = values[i]; } return sequenceCode(minValues, length); }
XZOrderSFC implements SpaceFillingCurve { @Override public byte[] getId(double[] values) { if (values.length == dimensionCount) { int boxCount = 0; final double[] boxedValues = new double[dimensionCount * 2]; for (int i = 0; i < dimensionCount; i++) { boxedValues[boxCount++] = values[i]; boxedValues[boxCount++] = values[i]; } values = boxedValues; } if (values.length != (dimensionCount * 2)) { LOGGER.error( "Point or bounding box value count does not match number of indexed dimensions."); return null; } normalize(values); double maxDim = 0.0; for (int i = 0; (i + 1) < values.length; i++) { maxDim = Math.max(maxDim, Math.abs(values[i] - values[++i])); } final int l1 = (int) Math.floor(Math.log(maxDim) / LOG_POINT_FIVE); int length = g; if (l1 < g) { final double w2 = Math.pow(0.5, l1 + 1); length = l1 + 1; for (int i = 0; (i + 1) < values.length; i++) { if (!predicate(values[i], values[++i], w2)) { length = l1; break; } } } final double[] minValues = new double[values.length / 2]; for (int i = 0; (i + 1) < values.length; i += 2) { minValues[i / 2] = values[i]; } return sequenceCode(minValues, length); } }
XZOrderSFC implements SpaceFillingCurve { @Override public byte[] getId(double[] values) { if (values.length == dimensionCount) { int boxCount = 0; final double[] boxedValues = new double[dimensionCount * 2]; for (int i = 0; i < dimensionCount; i++) { boxedValues[boxCount++] = values[i]; boxedValues[boxCount++] = values[i]; } values = boxedValues; } if (values.length != (dimensionCount * 2)) { LOGGER.error( "Point or bounding box value count does not match number of indexed dimensions."); return null; } normalize(values); double maxDim = 0.0; for (int i = 0; (i + 1) < values.length; i++) { maxDim = Math.max(maxDim, Math.abs(values[i] - values[++i])); } final int l1 = (int) Math.floor(Math.log(maxDim) / LOG_POINT_FIVE); int length = g; if (l1 < g) { final double w2 = Math.pow(0.5, l1 + 1); length = l1 + 1; for (int i = 0; (i + 1) < values.length; i++) { if (!predicate(values[i], values[++i], w2)) { length = l1; break; } } } final double[] minValues = new double[values.length / 2]; for (int i = 0; (i + 1) < values.length; i += 2) { minValues[i / 2] = values[i]; } return sequenceCode(minValues, length); } XZOrderSFC();  XZOrderSFC(final SFCDimensionDefinition[] dimensionDefs); }
XZOrderSFC implements SpaceFillingCurve { @Override public byte[] getId(double[] values) { if (values.length == dimensionCount) { int boxCount = 0; final double[] boxedValues = new double[dimensionCount * 2]; for (int i = 0; i < dimensionCount; i++) { boxedValues[boxCount++] = values[i]; boxedValues[boxCount++] = values[i]; } values = boxedValues; } if (values.length != (dimensionCount * 2)) { LOGGER.error( "Point or bounding box value count does not match number of indexed dimensions."); return null; } normalize(values); double maxDim = 0.0; for (int i = 0; (i + 1) < values.length; i++) { maxDim = Math.max(maxDim, Math.abs(values[i] - values[++i])); } final int l1 = (int) Math.floor(Math.log(maxDim) / LOG_POINT_FIVE); int length = g; if (l1 < g) { final double w2 = Math.pow(0.5, l1 + 1); length = l1 + 1; for (int i = 0; (i + 1) < values.length; i++) { if (!predicate(values[i], values[++i], w2)) { length = l1; break; } } } final double[] minValues = new double[values.length / 2]; for (int i = 0; (i + 1) < values.length; i += 2) { minValues[i / 2] = values[i]; } return sequenceCode(minValues, length); } XZOrderSFC();  XZOrderSFC(final SFCDimensionDefinition[] dimensionDefs); @Override byte[] getId(double[] values); @Override RangeDecomposition decomposeRangeFully(final MultiDimensionalNumericData query); @Override RangeDecomposition decomposeRange(
      final MultiDimensionalNumericData query,
      final boolean overInclusiveOnEdge,
      final int maxRanges); @Override byte[] toBinary(); @Override void fromBinary(final byte[] bytes); @Override double[] getInsertionIdRangePerDimension(); @Override BigInteger getEstimatedIdCount(final MultiDimensionalNumericData data); @Override MultiDimensionalNumericData getRanges(final byte[] id); @Override long[] getCoordinates(final byte[] id); @Override long[] normalizeRange(final double minValue, final double maxValue, final int dimension); }
XZOrderSFC implements SpaceFillingCurve { @Override public byte[] getId(double[] values) { if (values.length == dimensionCount) { int boxCount = 0; final double[] boxedValues = new double[dimensionCount * 2]; for (int i = 0; i < dimensionCount; i++) { boxedValues[boxCount++] = values[i]; boxedValues[boxCount++] = values[i]; } values = boxedValues; } if (values.length != (dimensionCount * 2)) { LOGGER.error( "Point or bounding box value count does not match number of indexed dimensions."); return null; } normalize(values); double maxDim = 0.0; for (int i = 0; (i + 1) < values.length; i++) { maxDim = Math.max(maxDim, Math.abs(values[i] - values[++i])); } final int l1 = (int) Math.floor(Math.log(maxDim) / LOG_POINT_FIVE); int length = g; if (l1 < g) { final double w2 = Math.pow(0.5, l1 + 1); length = l1 + 1; for (int i = 0; (i + 1) < values.length; i++) { if (!predicate(values[i], values[++i], w2)) { length = l1; break; } } } final double[] minValues = new double[values.length / 2]; for (int i = 0; (i + 1) < values.length; i += 2) { minValues[i / 2] = values[i]; } return sequenceCode(minValues, length); } XZOrderSFC();  XZOrderSFC(final SFCDimensionDefinition[] dimensionDefs); @Override byte[] getId(double[] values); @Override RangeDecomposition decomposeRangeFully(final MultiDimensionalNumericData query); @Override RangeDecomposition decomposeRange(
      final MultiDimensionalNumericData query,
      final boolean overInclusiveOnEdge,
      final int maxRanges); @Override byte[] toBinary(); @Override void fromBinary(final byte[] bytes); @Override double[] getInsertionIdRangePerDimension(); @Override BigInteger getEstimatedIdCount(final MultiDimensionalNumericData data); @Override MultiDimensionalNumericData getRanges(final byte[] id); @Override long[] getCoordinates(final byte[] id); @Override long[] normalizeRange(final double minValue, final double maxValue, final int dimension);  }