public Divide divide(Expression expr1, Expression expr2) { return new DivideImpl(expr1, expr2); }
public Object evaluate(Object feature) throws IllegalArgumentException { ensureOperandsSet(); double leftDouble = Filters.number(getExpression1().evaluate(feature)); double rightDouble = Filters.number(getExpression2().evaluate(feature)); return number(leftDouble / rightDouble); }
/** * Override of hashCode method. * * @return a hash code value for this divide expression. */ public int hashCode() { int result = 23; result = (37 * result) + getExpression1().hashCode(); result = (37 * result) + getExpression2().hashCode(); return result; }
public String toString() { return "(" + getExpression1().toString() + "/" + getExpression2().toString() + ")"; } }
public Object evaluate(Object feature) throws IllegalArgumentException { ensureOperandsSet(); double leftDouble = Filters.number( getExpression1().evaluate(feature) ); double rightDouble = Filters.number( getExpression2().evaluate(feature) ); return number(leftDouble / rightDouble); }
/** * Compares this expression to the specified object. Returns true if the * * @param obj - the object to compare this expression against. * @return true if specified object is equal to this expression; false otherwise. */ public boolean equals(Object obj) { if (obj instanceof DivideImpl) { DivideImpl other = (DivideImpl) obj; return Utilities.equals(getExpression1(), other.getExpression1()) && Utilities.equals(getExpression2(), other.getExpression2()); } else { return false; } }
break; case ExpressionType.MATH_DIVIDE: curExprssn = new DivideImpl(null, null); break; default:
public Object evaluate(Object feature) throws IllegalArgumentException { ensureOperandsSet(); double leftDouble = Filters.number( getExpression1().evaluate(feature) ); double rightDouble = Filters.number( getExpression2().evaluate(feature) ); return number(leftDouble / rightDouble); }
/** * Override of hashCode method. * * @return a hash code value for this divide expression. */ public int hashCode() { int result = 23; result = (37 * result) + getExpression1().hashCode(); result = (37 * result) + getExpression2().hashCode(); return result; }
public Divide divide(Expression expr1, Expression expr2) { return new DivideImpl(expr1,expr2); }
/** * Override of hashCode method. * * @return a hash code value for this divide expression. */ public int hashCode() { int result = 23; result = (37 * result) + getExpression1().hashCode(); result = (37 * result) + getExpression2().hashCode(); return result; }
public Divide divide(Expression expr1, Expression expr2) { return new DivideImpl(expr1,expr2); }
public String toString() { return "(" + getExpression1().toString() + "/" + getExpression2().toString()+ ")"; }
mathTest = new DivideImpl(null, null); mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2);
public String toString() { return "(" + getExpression1().toString() + "/" + getExpression2().toString()+ ")"; }
mathTest = new DivideImpl(null, null); mathTest.setExpression1(testAttribute1); mathTest.setExpression2(testAttribute2);
/** * Compares this expression to the specified object. Returns true if the * * @param obj - the object to compare this expression against. * * @return true if specified object is equal to this expression; false * otherwise. */ public boolean equals(Object obj) { if (obj instanceof DivideImpl) { DivideImpl other = (DivideImpl) obj; return Utilities.equals(getExpression1(),other.getExpression1()) && Utilities.equals(getExpression2(),other.getExpression2()); } else { return false; } }
/** * Gets the expression. * * @return the expression */ public Expression getExpression() { Expression expression = null; String selectedItem = (String) comboBox.getSelectedItem(); if (selectedItem != null) { if (selectedItem.equals(ADD)) { expression = new AddImpl(null, null); } else if (selectedItem.equals(SUBTRACT)) { expression = new SubtractImpl(null, null); } else if (selectedItem.equals(MULTIPLY)) { expression = new MultiplyImpl(null, null); } else if (selectedItem.equals(DIVIDE)) { expression = new DivideImpl(null, null); } } return expression; } }
/** * Compares this expression to the specified object. Returns true if the * * @param obj - the object to compare this expression against. * * @return true if specified object is equal to this expression; false * otherwise. */ public boolean equals(Object obj) { if (obj instanceof DivideImpl) { DivideImpl other = (DivideImpl) obj; return Utilities.equals(getExpression1(),other.getExpression1()) && Utilities.equals(getExpression2(),other.getExpression2()); } else { return false; } }
/** * Creates a Math Expression of the given type. * * @param expressionType must be a math expression type. * * @return The new Math Expression. * * @throws IllegalFilterException if there were creation problems. */ public MathExpression createMathExpression(short expressionType) throws IllegalFilterException { switch(expressionType) { case ExpressionType.MATH_ADD: return new AddImpl(null,null); case ExpressionType.MATH_SUBTRACT: return new SubtractImpl(null,null); case ExpressionType.MATH_MULTIPLY: return new MultiplyImpl(null,null); case ExpressionType.MATH_DIVIDE: return new DivideImpl(null,null); } throw new IllegalFilterException("Unsupported math expression"); }