net.scheinerman.phoenix.interpreter.variables
Class FunctionVariable

java.lang.Object
  extended by net.scheinerman.phoenix.interpreter.variables.AbstractVariable
      extended by net.scheinerman.phoenix.interpreter.variables.FunctionVariable
All Implemented Interfaces:
Variable

public class FunctionVariable
extends AbstractVariable


Field Summary
private  Function function
           
 
Fields inherited from class net.scheinerman.phoenix.interpreter.variables.AbstractVariable
constant, functionReference, literal
 
Constructor Summary
FunctionVariable(Function function)
           
 
Method Summary
 Variable add(Variable v)
          Takes two variables and returns the addition operator solution.
 Variable and(Variable v)
          Takes two variables and returns the logical and operator solution.
 void assign(Variable v)
          Assigns a new variable value to this variable.
 Variable copy()
          Returns a copy of this variable.
 Variable divide(Variable v)
          Takes two variables and returns the division operator solution.
 Variable exp(Variable v)
          Takes two variables and returns the exponentiation operator solution.
 Function getFunction()
           
 Variable greaterEqual(Variable v)
          Takes two variables and returns the greater than or equal to operator solution.
 Variable greaterThan(Variable v)
          Takes two variables and returns the greater than operator solution.
 Variable isEqualTo(Variable v)
          Takes two variables and returns the equality operator solution.
 Variable lessEqual(Variable v)
          Takes two variables and returns the less than or equal to operator solution.
 Variable lessThan(Variable v)
          Takes two variables and returns the less than operator solution.
 Variable mod(Variable v)
          Takes two variables and returns the modulus arithmetic operator solution.
 Variable multiply(Variable v)
          Takes two variables and returns the multiplication operator solution.
 Variable not()
          Returns the result of the logical not (complement) of this variable.
 Variable notEqualTo(Variable v)
          Takes two variables and returns the inequality operator solution.
 Variable or(Variable v)
          Takes two variables and returns the logical inclusive or operator solution.
 Variable round(Variable v)
          Takes two variables and returns the rouding operator solution.
 Variable subscript(Variable sub)
          Returns the result of a simple, one variable subscript of this variable.
 Variable subscript(Variable sub1, Variable sub2)
          Returns the result of a two variable subscript of this variable.
 Variable subtract(Variable v)
          Takes two variables and returns the subtraction operator solution.
 java.lang.String toString()
           
 Variable xor(Variable v)
          Takes two variables and returns the logical exclusive operator solution.
 
Methods inherited from class net.scheinerman.phoenix.interpreter.variables.AbstractVariable
equals, getType, isConstant, isFunctionReference, isLiteral, setConstant, setFunctionReference, setLiteral
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

function

private Function function
Constructor Detail

FunctionVariable

public FunctionVariable(Function function)
Method Detail

getFunction

public Function getFunction()

assign

public void assign(Variable v)
Description copied from interface: Variable
Assigns a new variable value to this variable. This method should check to make sure the variable is of the correct type and throw SyntaxException if it is not. This method must be supported, it should not throw a UnsupportedOperatorException.

Parameters:
v - - the variable to assign this variable to be

add

public Variable add(Variable v)
Description copied from interface: Variable
Takes two variables and returns the addition operator solution. The symbol for the addition operator is +. This method should provide functionality such that x.add(y) is equivalent to x + y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result

subtract

public Variable subtract(Variable v)
Description copied from interface: Variable
Takes two variables and returns the subtraction operator solution. The symbol for the subtraction operator is -. This method should provide functionality such that x.subtract(y) is equivalent to x - y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result

multiply

public Variable multiply(Variable v)
Description copied from interface: Variable
Takes two variables and returns the multiplication operator solution. The symbol for the multiplication operator is *. This method should provide functionality such that x.multiply(y) is equivalent to x * y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result

divide

public Variable divide(Variable v)
Description copied from interface: Variable
Takes two variables and returns the division operator solution. The symbol for the division operator is /. This method should provide functionality such that x.divide(y) is equivalent to x / y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result

mod

public Variable mod(Variable v)
Description copied from interface: Variable
Takes two variables and returns the modulus arithmetic operator solution. The symbol for the modulus arithmetic operator is %. This method should provide functionality such that x.mod(y) is equivalent to x % y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result

exp

public Variable exp(Variable v)
Description copied from interface: Variable
Takes two variables and returns the exponentiation operator solution. The symbol for the exponentiation operator is ^. This method should provide functionality such that x.exp(y) is equivalent to x ^ y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result

round

public Variable round(Variable v)
Description copied from interface: Variable
Takes two variables and returns the rouding operator solution. The symbol for the rounding operator is #. This method should provide functionality such that x.round(y) is equivalent to x # y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result

isEqualTo

public Variable isEqualTo(Variable v)
Description copied from interface: Variable
Takes two variables and returns the equality operator solution. The symbol for the equality operator is ==. This method should provide functionality such that x.isEqualTo(y) is equivalent to x == y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

notEqualTo

public Variable notEqualTo(Variable v)
Description copied from interface: Variable
Takes two variables and returns the inequality operator solution. The symbol for the inequality operator is !=. This method should provide functionality such that x.notEqualTo(y) is equivalent to x != y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

greaterThan

public Variable greaterThan(Variable v)
Description copied from interface: Variable
Takes two variables and returns the greater than operator solution. The symbol for the greater than operator is >. This method should provide functionality such that x.greaterThan(y) is equivalent to x > y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

lessThan

public Variable lessThan(Variable v)
Description copied from interface: Variable
Takes two variables and returns the less than operator solution. The symbol for the less than operator is <. This method should provide functionality such that x.lessThan(y) is equivalent to x < y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

greaterEqual

public Variable greaterEqual(Variable v)
Description copied from interface: Variable
Takes two variables and returns the greater than or equal to operator solution. The symbol for the greater than or equal to operator is >=. This method should provide functionality such that x.greaterEqual(y) is equivalent to x == y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

lessEqual

public Variable lessEqual(Variable v)
Description copied from interface: Variable
Takes two variables and returns the less than or equal to operator solution. The symbol for the less than or equal to operator is <=. This method should provide functionality such that x.lessEqual(y) is equivalent to x <= y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

and

public Variable and(Variable v)
Description copied from interface: Variable
Takes two variables and returns the logical and operator solution. The symbol for the and operator is &. This method should provide functionality such that x.and(y) is equivalent to x & y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

or

public Variable or(Variable v)
Description copied from interface: Variable
Takes two variables and returns the logical inclusive or operator solution. The symbol for the inclusive or operator is |. This method should provide functionality such that x.or(y) is equivalent to x | y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

xor

public Variable xor(Variable v)
Description copied from interface: Variable
Takes two variables and returns the logical exclusive operator solution. The symbol for the exclusive or operator is (+). This method should provide functionality such that x.xor(y) is equivalent to x (+) y. This operator is not required and can therefore throw the UnsupportedOperatorException. If the variable passed to this operator is of a wrong type a SyntaxException should be thrown.

Parameters:
v - - the variable to operate on
Returns:
the operator's result which should be a true or false solution

not

public Variable not()
Description copied from interface: Variable
Returns the result of the logical not (complement) of this variable. The symbol for the not operator is !. This method should provide functionality such that x.not() is equivalent to !x. This operator is not required and can therefore throw the UnsupportedOperatorException.

Returns:
the operator's result which should be a true or false solution

subscript

public Variable subscript(Variable sub)
Description copied from interface: Variable
Returns the result of a simple, one variable subscript of this variable. The symbol for the subscript operator is []. This method should provide functionality such that x.subscript(y) is equivalent to x[y]. This operator is not required and can therefore throw the UnsupportedOperatorException.

Parameters:
sub - - the variable to operate on
Returns:
the operator's result

subscript

public Variable subscript(Variable sub1,
                          Variable sub2)
Description copied from interface: Variable
Returns the result of a two variable subscript of this variable. The symbol for the subscript operator is []. This method should provide functionality such that x.subscript(y,z) is equivalent to x[y:z]. This operator is not required and can therefore throw the UnsupportedOperatorException.

Parameters:
sub1 - - the first subscript variable
sub2 - - the second subscript variable
Returns:
the operator's result

copy

public Variable copy()
Description copied from interface: Variable
Returns a copy of this variable.

Returns:
a copy with the same value of this variable.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object