Class IntComparison

java.lang.Object
  extended by ValueBase
      extended by FunctionBase
          extended by PrimitiveFunction
              extended by IntComparison
All Implemented Interfaces:
Function, Value

public abstract class IntComparison
extends PrimitiveFunction

An abstract base class for integer comparison functions such as <. These functions are all "curried", which means that they expect one argument (the left operand) and then produce a new function which in turn expects one argument (the right operand) before producing the final true/false result. This is necessary because we are requiring all functions to take just one argument.


Constructor Summary
IntComparison()
           
 
Method Summary
 Value apply(Value arg1)
          Apply this function to a specified argument Value.
abstract  boolean compute(int i1, int i2)
          This method should be implemented in each concrete subclass.
 
Methods inherited from class PrimitiveFunction
toString
 
Methods inherited from class ValueBase
as
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Value
as
 

Constructor Detail

IntComparison

public IntComparison()
Method Detail

compute

public abstract boolean compute(int i1,
                                int i2)
This method should be implemented in each concrete subclass. This is where the actual comparison takes place, whether that be <, >, or whatnot.

Parameters:
i1 - the left operand
i2 - the right operand
Returns:
the result of comparing i1 with i2

apply

public Value apply(Value arg1)
Description copied from interface: Function
Apply this function to a specified argument Value.

Parameters:
arg1 - the argument Value
Returns:
the result Value from the function application.