public class UnionToken extends AbstractNotConvertibleToken
Constructor and Description |
---|
UnionToken(java.lang.String init)
Construct a UnionToken from the specified string.
|
UnionToken(java.lang.String label,
Token value)
Construct a UnionToken with the specified label and value.
|
Modifier and Type | Method and Description |
---|---|
protected Token |
_add(Token rightArgument)
Return a new token whose value is the sum of this token and
the argument.
|
protected Token |
_divide(Token rightArgument)
Return a new token whose value is the division of
this token and the argument.
|
protected BooleanToken |
_isCloseTo(Token rightArgument,
double epsilon)
Test whether 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.
|
protected BooleanToken |
_isEqualTo(Token rightArgument)
Return true if the specified token is equal to this one.
|
protected Token |
_modulo(Token rightArgument)
Return a new token whose value is the modulo of this token and
the argument.
|
protected Token |
_multiply(Token rightArgument)
Return a new token whose value is the multiplication of this token
and the argument.
|
protected Token |
_subtract(Token rightArgument)
Return a new token whose value is the subtraction of this token
and the argument.
|
boolean |
equals(java.lang.Object object)
Return true if the argument is an UnionToken with the same
label and value.
|
Type |
getType()
Return the type of this token.
|
int |
hashCode()
Return a hash code value for this token.
|
java.lang.String |
label()
Return the label of this token.
|
Token |
one()
Returns a new UnionToken representing the multiplicative identity.
|
java.lang.String |
toString()
Return the value of this token as a string.
|
Token |
value()
Return the value of this token.
|
Token |
zero()
Returns a new UnionToken representing the additive identity.
|
add, addReverse, divide, divideReverse, isCloseTo, isEqualTo, modulo, moduloReverse, multiply, multiplyReverse, notSupportedDifferentClassesMessage, subtract, subtractReverse
isCloseTo, isNil, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, pow, zeroReturnType
public UnionToken(java.lang.String label, Token value) throws IllegalActionException
label
- The label.value
- The value of this token.IllegalActionException
- If the label or the value is null.public UnionToken(java.lang.String init) throws IllegalActionException
init
- A string expression of a record.IllegalActionException
- If the string does not
contain a parsable record.public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
- An instance of Object.hashCode()
public Type getType()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String label()
public Token one() throws IllegalActionException
one
in class Token
IllegalActionException
- If multiplicative identity is not
supported by any value token.public java.lang.String toString()
{|label = value|}
public Token value()
public Token zero() throws IllegalActionException
zero
in class Token
IllegalActionException
- If additive identity is not
supported by any value token.protected Token _add(Token rightArgument) throws IllegalActionException
_add
in class AbstractNotConvertibleToken
rightArgument
- The token to add to this token.IllegalActionException
- If the label of the argument
and this token are different, or calling the add method on
the value token throws it.protected Token _divide(Token rightArgument) throws IllegalActionException
_divide
in class AbstractNotConvertibleToken
rightArgument
- The token to divide this token by.IllegalActionException
- If the label of the argument
and this token are different, or calling the divide method on
the value token throws it.protected BooleanToken _isCloseTo(Token rightArgument, double epsilon) throws IllegalActionException
_isCloseTo
in class AbstractNotConvertibleToken
rightArgument
- The token to compare to this token.epsilon
- The value that we use to determine whether two
tokens are close.IllegalActionException
- If thrown by calling isCloseTo()
on the value of this Token.protected BooleanToken _isEqualTo(Token rightArgument) throws IllegalActionException
_isEqualTo
in class AbstractNotConvertibleToken
rightArgument
- The token to compare to this token.IllegalActionException
- If this method is not
supported by the derived class.protected Token _modulo(Token rightArgument) throws IllegalActionException
_modulo
in class AbstractNotConvertibleToken
rightArgument
- The token to modulo this token by.IllegalActionException
- If the label of the argument
and this token are different, or calling the modulo method on
the value token throws it.protected Token _multiply(Token rightArgument) throws IllegalActionException
_multiply
in class AbstractNotConvertibleToken
rightArgument
- The token to multiply this token by.IllegalActionException
- If the label of the argument
and this token are different, or calling the multiply method on
the value token throws it.protected Token _subtract(Token rightArgument) throws IllegalActionException
_subtract
in class AbstractNotConvertibleToken
rightArgument
- The token to subtract from this token.IllegalActionException
- If the label of the argument
and this token are different, or calling the subtract method on
the value token throws it.