public boolean isSmallerOrEqualTo(Limit other) { double thisNumber = this.number().doubleValue(); double otherNumber = other.number().doubleValue(); if (thisNumber == otherNumber) { if ( ! other.isInclusive()) return false; return true; } return thisNumber < otherNumber; }
public boolean isLargerOrEqualTo(Limit other) { double thisNumber = this.number().doubleValue(); double otherNumber = other.number().doubleValue(); if (thisNumber == otherNumber) { if ( ! other.isInclusive()) return false; return true; } return thisNumber > otherNumber; }
private void serializeAsRange(StringBuilder destination, IntItem intItem) { String annotations = leafAnnotations(intItem); boolean leftOpen = !intItem.getFromLimit().isInclusive(); boolean rightOpen = !intItem.getToLimit().isInclusive(); String boundsAnnotation = ""; int initLen;
@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; }