/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof LowerCase) { LowerCase that = (LowerCase)obj; return this.operand.equals(that.operand); } return false; }
/** * Create a arithmetic dynamic operand that operates upon the selector names * given by the supplied dynamic operand(s). * * @param operand * the operand defining the selector names */ protected DynamicOperand(DynamicOperand operand) { this(operand.getSelectorNames()); }
/** * {@inheritDoc} * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return operand.hashCode(); }
/** * {@inheritDoc} * @throws VisitException if exception occurs * * @see QueryObjectModelVisitor#visit(UpperCase) */ public void visit(UpperCase upperCase) throws VisitException { append("UPPER("); upperCase.getOperand().accept(this); append(')'); }
/** * {@inheritDoc} * @throws VisitException if exception occurs * * @see QueryObjectModelVisitor#visit(LowerCase) */ public void visit(LowerCase lowerCase) throws VisitException { append("LOWER("); lowerCase.getOperand().accept(this); append(')'); }
/** * {@inheritDoc} * @throws VisitException if exception occurs * * @see QueryObjectModelVisitor#visit(Ordering) */ public void visit(Ordering ordering) throws VisitException { ordering.getOperand().accept(this); append(' ').append(ordering.getOrder().getSymbol()); }
/** * {@inheritDoc} * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return getOperand().hashCode(); }
/** * Create a arithmetic dynamic operand that operates upon the selector names * given by the supplied dynamic operand(s). * * @param operands * the operands defining the selector names */ protected DynamicOperand(DynamicOperand... operands) { Validate.noNullElements(operands, "The operands argument may not be null"); Set<SelectorName> names = new LinkedHashSet<SelectorName>(); for (DynamicOperand operand : operands) { names.addAll(operand.getSelectorNames()); } this.selectorNames = Collections.unmodifiableSet(names); this.hcode = new HashCodeBuilder() .append(selectorNames) .toHashCode(); }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof UpperCase) { UpperCase that = (UpperCase)obj; return this.operand.equals(that.operand); } return false; }
/** * {@inheritDoc} * @throws VisitException if exception occurs * * @see QueryObjectModelVisitor#visit(Comparison) */ public void visit(Comparison comparison) throws VisitException { comparison.getOperand1().accept(this); append(' ').append(comparison.getOperator().getSymbol()).append(' '); comparison.getOperand2().accept(this); }
/** * Create a dynamic operand that evaluates to the property values of the node * identified by the selector. * * @param selectorName * the name of the selector * @param propertyName * the name of the property */ public PropertyValue(SelectorName selectorName, String propertyName) { super(selectorName); Validate.notNull(propertyName, "The propertyName argument may not be null"); this.propertyName = propertyName; this.hcode = new HashCodeBuilder() .appendSuper(super.hashCode()) .append(propertyName) .toHashCode(); }
/** * Create a arithmetic dynamic operand that operates upon the selector names * given by the supplied dynamic operand(s). * * @param operands * the operands defining the selector names */ protected DynamicOperand(Iterable<? extends DynamicOperand> operands) { Validate.notNull(operands, "The operands argument may not be null"); if (operands == null) { throw new IllegalArgumentException("operands shoud not be null"); } Set<SelectorName> names = new LinkedHashSet<SelectorName>(); for (DynamicOperand operand : operands) { Validate.notNull(operand, "The operand argument may not be null"); names.addAll(operand.getSelectorNames()); } this.selectorNames = Collections.unmodifiableSet(names); this.hcode = new HashCodeBuilder() .append(selectorNames) .toHashCode(); }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } PropertyValue rhs = (PropertyValue)obj; return new EqualsBuilder() .appendSuper(super.equals(obj)) .append(propertyName, rhs.propertyName) .isEquals(); }