com.singularsys.jep.bigdecimal.functions
Class BigDecRelational

java.lang.Object
  extended by com.singularsys.jep.functions.PostfixMathCommand
      extended by com.singularsys.jep.functions.BinaryFunction
          extended by com.singularsys.jep.bigdecimal.functions.BigDecRelational
All Implemented Interfaces:
PostfixMathCommandI, java.io.Serializable

public class BigDecRelational
extends BinaryFunction

Implements the relational operations <, >, <=, >=, != and ==. BigDecimals can be compared to each other. Boolean values can be compared to each other. If the allowStrings option is set then Strings can be compared to each other. An illegal parameter exception is thrown if BigDecimals and Booleans or BigDecimals and Strings or Booleans and Strings are compared.

Author:
N Funk
See Also:
Serialized Form

Field Summary
static int EQ
           
static int GE
           
static int GT
           
protected  int id
           
static int LE
           
static int LT
           
static int NE
           
 
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
 
Constructor Summary
BigDecRelational(int id_in)
          Constructor.
 
Method Summary
 java.lang.Object eval(java.lang.Object l, java.lang.Object r)
           
 boolean getAllowStrings()
          Whether comparing strings is allowed.
 void setAllowStrings(boolean allowStrings)
          Sets whether comparing strings is allowed.
 
Methods inherited from class com.singularsys.jep.functions.BinaryFunction
run
 
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, checkStack, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected int id

LT

public static final int LT
See Also:
Constant Field Values

GT

public static final int GT
See Also:
Constant Field Values

LE

public static final int LE
See Also:
Constant Field Values

GE

public static final int GE
See Also:
Constant Field Values

NE

public static final int NE
See Also:
Constant Field Values

EQ

public static final int EQ
See Also:
Constant Field Values
Constructor Detail

BigDecRelational

public BigDecRelational(int id_in)
Constructor. Sets the number of parameters to 2.

Parameters:
id_in - The id of the comparative operator.
Method Detail

eval

public java.lang.Object eval(java.lang.Object l,
                             java.lang.Object r)
                      throws EvaluationException
Specified by:
eval in class BinaryFunction
Throws:
EvaluationException

getAllowStrings

public boolean getAllowStrings()
Whether comparing strings is allowed.

Returns:
true if allowed
Since:
3.4.0

setAllowStrings

public void setAllowStrings(boolean allowStrings)
Sets whether comparing strings is allowed.

Parameters:
allowStrings - When true, strings are allowed. When false an IllegalParameterException is thrown during evaluation.
Since:
3.4.0


Copyright © 2010 Singular Systems http://www.singularsys.com/jep