public class StringToken extends AbstractConvertibleToken
Red (cxh) nil token code |
Yellow (cxh) |
Modifier and Type | Field and Description |
---|---|
static StringToken |
NIL
A token that represents a missing value.
|
Constructor and Description |
---|
StringToken()
Construct a token with an empty string.
|
StringToken(java.lang.String value)
Construct a token with the specified string.
|
Modifier and Type | Method and Description |
---|---|
protected Token |
_add(Token rightArgument)
Return a new token whose value is the value of the
argument Token added to the value of this Token.
|
protected Token |
_divide(Token rightArgument)
Return a new token whose value is the value of this token
divided by the value of the argument token.
|
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.
|
protected Token |
_modulo(Token rightArgument)
Return a new token whose value is the value of this token
modulo the value of the argument token.
|
protected Token |
_multiply(Token rightArgument)
Return a new token whose value is the value of this token
multiplied by the value of the argument token.
|
protected Token |
_subtract(Token rightArgument)
Return a new token whose value is the value of the argument token
subtracted from the value of this token.
|
static StringToken |
convert(Token token)
Convert the specified token into an instance of StringToken.
|
boolean |
equals(java.lang.Object object)
Return true if the argument is an instance of StringToken with the
same value.
|
Type |
getType()
Return the type of this token.
|
int |
hashCode()
Return a hash code value for this token.
|
boolean |
isNil()
Return true if the token is nil, (aka null or missing).
|
java.lang.String |
stringValue()
Return the string that this token contains.
|
java.lang.String |
toString()
Return the value of this Token as a string.
|
Token |
zero()
Return a StringToken containing an empty string, which is considered
as the additive identity of string.
|
add, addReverse, divide, divideReverse, isCloseTo, isEqualTo, modulo, moduloReverse, multiply, multiplyReverse, subtract, subtractReverse
isCloseTo, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, zeroReturnType
public static final StringToken NIL
public StringToken()
public StringToken(java.lang.String value)
value
- The specified string.public static StringToken convert(Token token) throws IllegalActionException
NIL
is returned.
Otherwise, if the argument is below StringToken in the type
hierarchy, it is converted to an instance of StringToken or
one of the subclasses of StringToken and returned. If none of
the above condition is met, an exception is thrown.token
- The token to be converted to a StringToken.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 int hashCode()
hashCode
in class java.lang.Object
public boolean isNil()
public java.lang.String stringValue()
public java.lang.String toString()
public Token zero()
protected Token _add(Token rightArgument) throws IllegalActionException
_add
in class AbstractConvertibleToken
rightArgument
- The token whose value we add to the value of
this token.IllegalActionException
- If this method is not
supported by the derived class.protected Token _divide(Token rightArgument) throws IllegalActionException
_divide
in class AbstractConvertibleToken
rightArgument
- The token to divide this token by.IllegalActionException
- If this method is not
supported by the derived class.protected BooleanToken _isCloseTo(Token rightArgument, double epsilon) throws IllegalActionException
_isCloseTo
in class AbstractConvertibleToken
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
_isEqualTo
in class AbstractConvertibleToken
rightArgument
- The token to add to this token.IllegalActionException
- If this method is not
supported by the derived class.protected Token _modulo(Token rightArgument) throws IllegalActionException
_modulo
in class AbstractConvertibleToken
rightArgument
- The token to modulo this token by.IllegalActionException
- If this method is not
supported by the derived class.protected Token _multiply(Token rightArgument) throws IllegalActionException
_multiply
in class AbstractConvertibleToken
rightArgument
- The token to multiply this token by.IllegalActionException
- If this method is not
supported by the derived class.protected Token _subtract(Token rightArgument) throws IllegalActionException
_subtract
in class AbstractConvertibleToken
rightArgument
- The token to subtract from this token.IllegalActionException
- If this method is not
supported by the derived class.