Beispiel #1
0
  public Tuple get(Key key) {
    int closestIndex = sortedByteMap.floorIndex(key);

    if (closestIndex < 0 || closestIndex >= sortedByteMap.entryCount()) {
      return null;
    }

    Tuple closestTuple = deserialize(closestIndex);
    return closestTuple.key().data().equals(key.data()) ? closestTuple : null;
  }
Beispiel #2
0
 private Tuple deserialize(int index) {
   SortedByteMap.Entry entry = sortedByteMap.get(index);
   return new Tuple(entry.key(), entry.value());
 }
Beispiel #3
0
 @Override
 public MemoryPointer memory() {
   return sortedByteMap.memory();
 }
Beispiel #4
0
 @Override
 public Iterator<Tuple> iterator() {
   return new TupleIterator(sortedByteMap.ascendingIterator());
 }
Beispiel #5
0
 public Iterator<Tuple> descendingIterator(Key key) {
   return new TupleIterator(sortedByteMap.descendingIterator(key));
 }