|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.data.Token
ptolemy.data.FunctionToken
public class FunctionToken
A token that contains a function. The function takes a fixed number of arguments, supplied as a list of tokens. Currently, no operations between function tokens (add, multiply, etc.) are supported.
Red (liuxj) |
Yellow (liuxj) |
Field Summary | |
---|---|
private Function |
_function
|
private FunctionType |
_type
|
Fields inherited from class ptolemy.data.Token |
---|
NIL |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class ptolemy.data.Token |
---|
add, addReverse, divide, divideReverse, isCloseTo, isNil, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Function _function
private FunctionType _type
Constructor Detail |
---|
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.Method Detail |
---|
public Token apply(Token[] args) throws IllegalActionException
args
- the arguments to which the function is applied
IllegalActionException
- If the arguments are not
compatible with this function, or an error occurs during
evaluation.public Function getFunction()
public int getNumberOfArguments()
public Type getType()
getType
in class Token
public BooleanToken isCloseTo(Token rightArgument, double epsilon)
isCloseTo
in class Token
rightArgument
- The token to compare to this token.epsilon
- This argument is ignored in this method.
public BooleanToken isEqualTo(Token rightArgument)
isEqualTo
in class Token
rightArgument
- The token to compare to this token.
public java.lang.String toString()
toString
in class Token
Token.NIL
,
in which case return the String "nil".
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |