org.apache.accumulo.examples.wikisearch.jexl
Class Arithmetic

java.lang.Object
  extended by org.apache.commons.jexl2.JexlArithmetic
      extended by org.apache.accumulo.examples.wikisearch.jexl.Arithmetic

public class Arithmetic
extends org.apache.commons.jexl2.JexlArithmetic


Field Summary
 
Fields inherited from class org.apache.commons.jexl2.JexlArithmetic
BIGD_DOUBLE_MAX_VALUE, BIGD_DOUBLE_MIN_VALUE, BIGI_LONG_MAX_VALUE, BIGI_LONG_MIN_VALUE
 
Constructor Summary
Arithmetic(boolean lenient)
           
 
Method Summary
 boolean equals(Object left, Object right)
          This method differs from the parent class in that we are going to try and do a better job of coercing the types.
protected  Object fixLeft(Object left, Object right)
           
 boolean lessThan(Object left, Object right)
           
 boolean matches(Object left, Object right)
          This method differs from the parent in that we are not calling String.matches() because it does not match on a newline.
 
Methods inherited from class org.apache.commons.jexl2.JexlArithmetic
add, controlNullNullOperands, controlNullOperand, divide, greaterThan, greaterThanOrEqual, isFloatingPoint, isFloatingPointNumber, isFloatingPointType, isLenient, isNumberable, lessThanOrEqual, mod, multiply, narrow, narrowArguments, narrowArrayType, narrowBigInteger, subtract, toBigDecimal, toBigInteger, toBoolean, toDouble, toInteger, toLong, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Arithmetic

public Arithmetic(boolean lenient)
Method Detail

matches

public boolean matches(Object left,
                       Object right)
This method differs from the parent in that we are not calling String.matches() because it does not match on a newline. Instead we are handling this case.

Overrides:
matches in class org.apache.commons.jexl2.JexlArithmetic
Parameters:
left - first value
right - second value
Returns:
test result.

equals

public boolean equals(Object left,
                      Object right)
This method differs from the parent class in that we are going to try and do a better job of coercing the types. As a last resort we will do a string comparison and try not to throw a NumberFormatException. The JexlArithmetic class performs coercion to a particular type if either the left or the right match a known type. We will look at the type of the right operator and try to make the left of the same type.

Overrides:
equals in class org.apache.commons.jexl2.JexlArithmetic

lessThan

public boolean lessThan(Object left,
                        Object right)
Overrides:
lessThan in class org.apache.commons.jexl2.JexlArithmetic

fixLeft

protected Object fixLeft(Object left,
                         Object right)


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.