: encode(pr.last.getValue(Type.STRING));
if (firstEncoded != null && !firstEncoded.equals(lastEncoded)) {
// '>' & '>=' and between use case
LOG.debug("'>' & '>=' and between use case");
ChildNodeEntry firstValueableItem;
String firstValuableItemKey;
Iterable<String> it = Collections.emptyList();
Iterable<ChildNodeEntry> childrenIterable;
if (lastEncoded == null) {
LOG.debug("> & >= case.");
firstValuableItemKey = seek(index,
new PredicateGreaterThan(firstEncoded, pr.firstIncluding));
if (firstValuableItemKey != null) {
firstValueableItem = new OrderedChildNodeEntry(firstValuableItemKey,
indexState.getChildNode(firstValuableItemKey));
if (direction.isAscending()) {
childrenIterable = new SeekedIterable(indexState, firstValueableItem);
it = new QueryResultsWrapper(filter, indexName, childrenIterable);
} else {
it = new QueryResultsWrapper(filter, indexName, new BetweenIterable(
indexState, firstValueableItem, firstEncoded,
pr.firstIncluding, direction));
}
}
} else {
String first, last;
boolean includeFirst, includeLast;
first = firstEncoded;
last = lastEncoded;
includeFirst = pr.firstIncluding;
includeLast = pr.lastIncluding;
if (LOG.isDebugEnabled()) {
final String op1 = includeFirst ? ">=" : ">";
final String op2 = includeLast ? "<=" : "<";
LOG.debug("in between case. direction: {} - Condition: (x {} {} AND x {} {})",
new Object[] { direction, op1, first, op2, last });
}
if (direction.equals(OrderDirection.ASC)) {
firstValuableItemKey = seek(index,
new PredicateGreaterThan(first, includeFirst));
} else {
firstValuableItemKey = seek(index,
new PredicateLessThan(last, includeLast));
}
LOG.debug("firstValueableItem: {}", firstValuableItemKey);
if (firstValuableItemKey != null) {
firstValueableItem = new OrderedChildNodeEntry(firstValuableItemKey,
indexState.getChildNode(firstValuableItemKey));
childrenIterable = new BetweenIterable(indexState, firstValueableItem, last,
includeLast, direction);
it = new QueryResultsWrapper(filter, indexName, childrenIterable);
}
}
return it;
} else if (lastEncoded != null && !lastEncoded.equals(firstEncoded)) {
// '<' & '<=' use case
LOG.debug("'<' & '<=' use case");
final String searchfor = lastEncoded;
final boolean include = pr.lastIncluding;
Predicate<String> predicate = new PredicateLessThan(searchfor, include);
LOG.debug("< & <= case. - searchfor: {} - include: {} - predicate: {}",
new Object[] { searchfor, include, predicate });
ChildNodeEntry firstValueableItem;
String firstValueableItemKey = seek(index, predicate);
LOG.debug("firstValuableItem: {}", firstValueableItemKey);
Iterable<String> it = Collections.emptyList();