public class ObjectToken extends Token
Yellow (wbwu) |
Yellow (yuhong) |
Modifier and Type | Field and Description |
---|---|
static ObjectToken |
NULL
A new empty ObjectToken.
|
Constructor and Description |
---|
ObjectToken()
Construct an empty token.
|
ObjectToken(java.lang.Object value)
Construct a token with a reference to the specified object.
|
ObjectToken(java.lang.Object value,
java.lang.Class<?> valueClass)
Construct a token with the given value and the given class as the
value's type.
|
Modifier and Type | Method and Description |
---|---|
protected BooleanToken |
_isCloseTo(Token rightArgument,
double epsilon)
Test for closeness of the values of this Token and the argument
Token.
|
protected BooleanToken |
_isEqualTo(Token rightArgument)
Test for equality of the values of this Token and the argument
Token.
|
static ObjectToken |
convert(Token token)
Convert the specified token into an instance of ObjectToken.
|
boolean |
equals(java.lang.Object object)
Return true if the argument is an instance of ObjectToken and its
contained object is equal to the object contained in this token,
as tested by the equals() method of the contained object.
|
Type |
getType()
Return the type of this token.
|
java.lang.Object |
getValue()
Return the value of the token, a reference to an object.
|
java.lang.Class |
getValueClass()
Return the class of the object contained in this token.
|
int |
hashCode()
Return a hash code value for this token.
|
BooleanToken |
isCloseTo(Token token,
double epsilon)
Test that the value of this token is close to the first argument,
where "close" means that the distance between them is less than
or equal to the second argument.
|
BooleanToken |
isEqualTo(Token rightArgument)
Compare this ObjectToken to the given argument, and return true if the
values contained in the two are the same Java object.
|
static ObjectToken |
object(java.lang.String className)
Return an ObjectToken with value null and class specified by the
className argument.
|
java.lang.String |
toString()
Return the value of this token as a string.
|
add, addReverse, divide, divideReverse, isCloseTo, isNil, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType
public static final ObjectToken NULL
public ObjectToken()
public ObjectToken(java.lang.Object value) throws IllegalActionException
value
- The specified object referred to by this token.IllegalActionException
- If the argument is not of
the appropriate type (may be thrown by derived classes, but is
not thrown here).public ObjectToken(java.lang.Object value, java.lang.Class<?> valueClass) throws IllegalActionException
value
- The value.valueClass
- The class of the value.IllegalActionException
- If the argument is not of
the appropriate type.public static ObjectToken convert(Token token) throws IllegalActionException
token
- The token to be converted to an ObjectToken.IllegalActionException
- If the conversion
cannot be carried out.public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- An instance of Object.public Type getType()
public java.lang.Object getValue()
public java.lang.Class getValueClass()
public int hashCode()
hashCode
in class java.lang.Object
public final BooleanToken isCloseTo(Token token, double epsilon) throws IllegalActionException
Subclasses should not generally override this method, but override the protected _isCloseTo() method to ensure that type conversion is performed consistently.
isCloseTo
in class Token
token
- The token to test closeness of this token with.epsilon
- The value that we use to determine whether two
tokens are close. Ignored in this class.IllegalActionException
- If the argument token and
this token are of incomparable types, or the operation does
not make sense for the given types.public BooleanToken isEqualTo(Token rightArgument)
public static ObjectToken object(java.lang.String className) throws IllegalActionException
className
- The className.IllegalActionException
- If the class with className as its name
cannot be loaded.public java.lang.String toString()
protected BooleanToken _isCloseTo(Token rightArgument, double epsilon) throws IllegalActionException
rightArgument
- The token to add to this token.epsilon
- The value that we use to determine whether two
tokens are close. This parameter is ignored by this class.IllegalActionException
- If this method is not
supported by the derived class.protected BooleanToken _isEqualTo(Token rightArgument) throws IllegalActionException
rightArgument
- The token to add to this token.IllegalActionException
- If this method is not
supported by the derived class.