Example #1
0
 @Override
 public List<ByteArrayId> getInsertionIds(final MultiDimensionalNumericData indexedData) {
   final List<ByteArrayId> ids = new ArrayList<ByteArrayId>();
   for (final NumericData data : indexedData.getDataPerDimension()) {
     ids.add(new ByteArrayId(Double.toString(data.getCentroid()).getBytes()));
   }
   return ids;
 }
 protected static MultiDimensionalNumericData getRangeForId(
     final byte[] rowId,
     final NumericDimensionDefinition[] baseDefinitions,
     final SpaceFillingCurve sfc) {
   final SFCIdAndBinInfo sfcIdAndBinInfo = getSFCIdAndBinInfo(rowId, baseDefinitions);
   final MultiDimensionalNumericData numericData = sfc.getRanges(sfcIdAndBinInfo.sfcId);
   // now we need to unapply the bins to the data, denormalizing the
   // ranges to the native bounds
   if (sfcIdAndBinInfo.rowIdOffset > 1) {
     final NumericData[] data = numericData.getDataPerDimension();
     for (final Entry<Integer, byte[]> entry : sfcIdAndBinInfo.binIds.entrySet()) {
       final int dimension = entry.getKey();
       final NumericRange range =
           baseDefinitions[dimension].getDenormalizedRange(
               new BinRange(
                   entry.getValue(), data[dimension].getMin(), data[dimension].getMax(), false));
       data[dimension] = range;
     }
     return new BasicNumericDataset(data);
   }
   return numericData;
 }