/** Returns the upper limit of this range, which may be positive infinity */ public final Number getTo() { return getToLimit().number(); }
/** Returns the lower limit of this range, which may be negative infinity */ public final Number getFrom() { return getFromLimit().number(); }
/** Returns the simplest expression matching this */ private String toExpression(Limit from, Limit to, int hitLimit) { if (from.equals(to) && hitLimit == 0) return from.number().toString(); String expression = from.toRangeStart() + ";" + to.toRangeEnd(); if (hitLimit == 0) return expression; // Insert ;hitLimit at the end inside the brackets return expression.substring(0, expression.length()-1) + ";" + hitLimit + expression.substring(expression.length()-1); }
@Override boolean serialize(StringBuilder destination, Item item) { IntItem intItem = (IntItem) item; if (intItem.getFromLimit().number().equals(intItem.getToLimit().number())) { destination.append(normalizeIndexName(intItem.getIndexName())).append(" = "); annotatedNumberImage(intItem, intItem.getFromLimit().number().toString(), destination); } else if (intItem.getFromLimit().isInfinite()) { destination.append(normalizeIndexName(intItem.getIndexName())); destination.append(intItem.getToLimit().isInclusive() ? " <= " : " < "); annotatedNumberImage(intItem, intItem.getToLimit().number().toString(), destination); } else if (intItem.getToLimit().isInfinite()) { destination.append(normalizeIndexName(intItem.getIndexName())); destination.append(intItem.getFromLimit().isInclusive() ? " >= " : " > "); annotatedNumberImage(intItem, intItem.getFromLimit().number().toString(), destination); } else { serializeAsRange(destination, intItem); } return false; }