/** * Returns a String representation of this SubQueryConstraint object, suitable for forming part of * an SQL Query. * * @return the String representation */ @Override public String getSQLString() { if (right.getSelect().size() != 1) { throw (new IllegalStateException("Right must have one result column only")); } return left.getSQLString() + " IN (" + right.getSQLString() + ")"; }
public Any next() { Object o = enumeration_.nextElement(); if (o == null) return null; if (o instanceof Any) return (Any) o; return AbstractValue.flyweightString(o.toString()); }
/** * Compare this SubQueryConstraint with another AbstractConstraint, ignoring aliases in member * fields and tables. * * <p>{@inheritDoc} */ @Override public int compare( AbstractConstraint obj, Map<AbstractTable, AbstractTable> tableMap, Map<AbstractTable, AbstractTable> reverseTableMap) { if (obj instanceof SubQueryConstraint) { SubQueryConstraint objC = (SubQueryConstraint) obj; return (left.valueEquals(objC.left, tableMap, reverseTableMap) && right.equals(objC.right) ? EQUAL : INDEPENDENT); // TODO: Implement this a bit better maybe? Two unequal queries may actually have the // same set of results. Also, a Query with less Constraints should result in a // SubQueryConstraint that is less restrictive. Complicated. } else if (obj instanceof NotConstraint) { NotConstraint objNC = (NotConstraint) obj; return alterComparisonNotObj(compare(objNC.con, tableMap, reverseTableMap)); } return INDEPENDENT; }
@Override public AbstractValue sub(AbstractValue value) { return value.subMoney(this); }
@Override public AbstractValue mul(AbstractValue value) { return value.mulMoney(this); }
@Override public AbstractValue div(AbstractValue value) { return value.divMoney(this); }
@Override public AbstractValue add(AbstractValue value) { return value.addMoney(this); }
@Override public AbstractValue lt(AbstractValue value) { return value.ltMoney(this); }
@Override public AbstractValue geq(AbstractValue value) { return value.geqMoney(this); }
/** * Overrides Object.hashCode(). * * @return an arbitrary integer based on the contents of the Constraint */ @Override public int hashCode() { return (3 * left.hashCode()) + (5 * right.hashCode()); }