// one
// only
// for
// ranges!
final TIntArrayList values = new TIntArrayList();
LeafNode<KeyType, TIntArrayList> ln = null;
Node<KeyType, TIntArrayList> nd;
boolean isFinalBreak = false;
if (_diff == null) {
// Get root
if (_index.getRoot() instanceof MemoryInnerNode) {
final MemoryInnerNode<KeyType, TIntArrayList> root = (MemoryInnerNode<KeyType, TIntArrayList>) _index
.getRoot();
if (root == null)
return null;
// Go down to left most node
nd = root.getChild(0);
while (nd != null && nd instanceof MemoryInnerNode)
nd = ((MemoryInnerNode<KeyType, TIntArrayList>) nd).getChild(0);
if (nd == null)
return null;
ln = (MemoryLeafNode<KeyType, TIntArrayList>) nd;
} else
ln = (MemoryLeafNode<KeyType, TIntArrayList>) _index.getRoot();
} else {
ln = _index.findLeafNode(performOperation(key, _diff));
if (ln == null)
return null;
}
// Iterate over leaf nodes
do {
// For each slot in the current leaf
if (ln == null)
break;
for (int s = 0; s < ln.getSlots(); s++)
// While the key is less or equal (if needed), continue
if (ln.getKey(s).compareTo(key) < 0
|| (ln.getKey(s).compareTo(key) == 0 && includeEqual)) {
if ((_diff != null && ln.getKey(s).compareTo(performOperation(key, _diff)) < 0))
// break;
continue;
// Get the corresponding list with values and append its
// contents to the final result
final TIntArrayList slotVals = ln.getValue(s);
for (int i = 0; i < slotVals.size(); i++)
values.add(slotVals.get(i));
} else {
isFinalBreak = true;
break;
}
if (isFinalBreak)