public class FunctionToken extends Token
Red (liuxj) |
Yellow (liuxj) |
Constructor and Description |
---|
FunctionToken(Function f,
FunctionType type)
Create a new FunctionToken that applies the given function.
|
FunctionToken(java.lang.String init)
Create a new FunctionToken from the given string.
|
Modifier and Type | Method and Description |
---|---|
Token |
apply(Token[] args)
Apply this function to the given list of arguments.
|
Function |
getFunction()
Return the function of this token.
|
int |
getNumberOfArguments()
Return the number of arguments of the function.
|
Type |
getType()
Return the type of this token.
|
BooleanToken |
isCloseTo(Token rightArgument,
double epsilon)
Test for closeness of the values of this Token and the argument
Token.
|
BooleanToken |
isEqualTo(Token rightArgument)
Test for equality of the values of this Token and the argument
Token.
|
java.lang.String |
toString()
Return a String representation of this function.
|
add, addReverse, divide, divideReverse, isCloseTo, isNil, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType
public FunctionToken(Function f, FunctionType type)
f
- The function.type
- The function type.public FunctionToken(java.lang.String init) throws IllegalActionException
init
- The initialization string, for example
function(x,y) 4+x+y
.IllegalActionException
- If an error occurs, or the
string cannot be parsed into a function.public Token apply(Token[] args) throws IllegalActionException
args
- the arguments to which the function is appliedIllegalActionException
- If the arguments are not
compatible with this function, or an error occurs during
evaluation.public Function getFunction()
public int getNumberOfArguments()
public Type getType()
public BooleanToken isCloseTo(Token rightArgument, double epsilon)
public BooleanToken isEqualTo(Token rightArgument)