ptolemy.actor.gt
Class FakedRecordToken

java.lang.Object
  extended by ptolemy.data.Token
      extended by ptolemy.data.AbstractNotConvertibleToken
          extended by ptolemy.data.RecordToken
              extended by ptolemy.actor.gt.FakedRecordToken
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CriterionToken, NamedObjToken

public class FakedRecordToken
extends RecordToken

Since:
Ptolemy II 6.1
Version:
$Id: FakedRecordToken.java,v 1.5.4.1 2008/03/25 22:12:08 cxh Exp $
Author:
Thomas Huining Feng
See Also:
Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Red (tfeng)

Nested Class Summary
static class FakedRecordToken.FakedRecordType
           
 
Field Summary
 
Fields inherited from class ptolemy.data.Token
NIL
 
Constructor Summary
FakedRecordToken()
           
 
Method Summary
protected  Token _add(Token rightArgument)
          Return a new token whose value is the field-wise addition of this token and the argument.
protected  Token _divide(Token rightArgument)
          Return a new token whose value is the field-wise 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 token)
          Return true if the specified token is equal to this one.
protected  Token _modulo(Token rightArgument)
          Return a new token whose value is the field-wise modulo of this token and the argument.
protected  Token _multiply(Token rightArgument)
          Return a new token whose value is the field-wise multiplication of this token and the argument.
protected  Token _subtract(Token rightArgument)
          Return a new token whose value is the field-wise subtraction of this token and the argument.
 boolean equals(java.lang.Object object)
          Return true if the class of the argument is RecordToken, and the argument has the same set of labels as this token and the corresponding fields are equal, as determined by the equals method of the contained tokens.
 Token get(java.lang.String label)
          Return the token with the specified label.
 Type getType()
          Return the type of this token.
 int hashCode()
          Return a hash code value for this token.
 java.util.Set<java.lang.String> labelSet()
          Return the labels of this token as a Set.
 int length()
          Return the length of this token.
 Token one()
          Returns a new RecordToken representing the multiplicative identity.
 Token zero()
          Returns a new RecordToken representing the additive identity.
 
Methods inherited from class ptolemy.data.RecordToken
merge, mergeReturnType, toString
 
Methods inherited from class ptolemy.data.AbstractNotConvertibleToken
add, addReverse, divide, divideReverse, isCloseTo, isEqualTo, modulo, moduloReverse, multiply, multiplyReverse, notSupportedDifferentClassesMessage, subtract, subtractReverse
 
Methods inherited from class ptolemy.data.Token
isCloseTo, isNil, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, pow, zeroReturnType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FakedRecordToken

public FakedRecordToken()
                 throws IllegalActionException
Throws:
IllegalActionException
Method Detail

equals

public boolean equals(java.lang.Object object)
Description copied from class: RecordToken
Return true if the class of the argument is RecordToken, and the argument has the same set of labels as this token and the corresponding fields are equal, as determined by the equals method of the contained tokens.

Overrides:
equals in class RecordToken
Parameters:
object - An instance of Object.
Returns:
True if the argument is equal to this token.
See Also:
RecordToken.hashCode()

get

public Token get(java.lang.String label)
Description copied from class: RecordToken
Return the token with the specified label. If this token does not contain the specified label, return null.

Overrides:
get in class RecordToken
Parameters:
label - A String label.
Returns:
A Token.

getType

public Type getType()
Description copied from class: RecordToken
Return the type of this token.

Overrides:
getType in class RecordToken
Returns:
An instance of RecordType.

hashCode

public int hashCode()
Description copied from class: RecordToken
Return a hash code value for this token. This method returns the sum of the hash codes of the element tokens.

Overrides:
hashCode in class RecordToken
Returns:
A hash code value for this token.

labelSet

public java.util.Set<java.lang.String> labelSet()
Description copied from class: RecordToken
Return the labels of this token as a Set.

Overrides:
labelSet in class RecordToken
Returns:
A Set containing labels.

length

public int length()
Description copied from class: RecordToken
Return the length of this token.

Overrides:
length in class RecordToken
Returns:
The length of this token, which is greater than or equal to zero.

one

public Token one()
          throws IllegalActionException
Description copied from class: RecordToken
Returns a new RecordToken representing the multiplicative identity. The returned token has the same set of labels as this one, and each field contains the multiplicative identity of the corresponding field of this token.

Overrides:
one in class RecordToken
Returns:
A RecordToken.
Throws:
IllegalActionException - If multiplicative identity is not supported by any element token.

zero

public Token zero()
           throws IllegalActionException
Description copied from class: RecordToken
Returns a new RecordToken representing the additive identity. The returned token has the same set of labels as this one, and each field contains the additive identity of the corresponding field of this token.

Overrides:
zero in class RecordToken
Returns:
A RecordToken.
Throws:
IllegalActionException - If additive identity is not supported by any element token.

_add

protected Token _add(Token rightArgument)
              throws IllegalActionException
Description copied from class: RecordToken
Return a new token whose value is the field-wise addition of this token and the argument. It is assumed that the class of the argument is RecordToken.

Overrides:
_add in class RecordToken
Parameters:
rightArgument - The token to add to this token.
Returns:
A new RecordToken.
Throws:
IllegalActionException - If calling the add method on one of the record fields throws it.

_divide

protected Token _divide(Token rightArgument)
                 throws IllegalActionException
Description copied from class: RecordToken
Return a new token whose value is the field-wise division of this token and the argument. It is assumed that the class of the argument is RecordToken.

Overrides:
_divide in class RecordToken
Parameters:
rightArgument - The token to divide this token by.
Returns:
A new RecordToken.
Throws:
IllegalActionException - If calling the divide method on one of the record fields throws it.

_isCloseTo

protected BooleanToken _isCloseTo(Token rightArgument,
                                  double epsilon)
                           throws IllegalActionException
Description copied from class: RecordToken
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. This method only makes sense for tokens where the distance between them is reasonably represented as a double. It is assumed that the argument is an RecordToken, and the isCloseTo() method of the fields is used. If the fields do not match, then the return value is false.

Overrides:
_isCloseTo in class RecordToken
Parameters:
rightArgument - The token to compare to this token.
epsilon - The value that we use to determine whether two tokens are close.
Returns:
A token containing true if the value of the first argument is close to the value of this token.
Throws:
IllegalActionException - If throw while checking the closeness of an element of the record.

_isEqualTo

protected BooleanToken _isEqualTo(Token token)
                           throws IllegalActionException
Description copied from class: RecordToken
Return true if the specified token is equal to this one. Equal means that both tokens have the same labels with the same values. This method is different from equals() in that _isEqualTo() looks for equalities of values irrespective of their types. It is assumed that the type of the argument is RecordToken.

Overrides:
_isEqualTo in class RecordToken
Parameters:
token - The token to compare to this token.
Returns:
True if the argument is equal to this.
Throws:
IllegalActionException - If this method is not supported by the derived class.

_modulo

protected Token _modulo(Token rightArgument)
                 throws IllegalActionException
Description copied from class: RecordToken
Return a new token whose value is the field-wise modulo of this token and the argument. It is assumed that the class of the argument is RecordToken.

Overrides:
_modulo in class RecordToken
Parameters:
rightArgument - The token to modulo this token by.
Returns:
A new RecordToken.
Throws:
IllegalActionException - If calling the modulo method on one of the record fields throws it.

_multiply

protected Token _multiply(Token rightArgument)
                   throws IllegalActionException
Description copied from class: RecordToken
Return a new token whose value is the field-wise multiplication of this token and the argument. It is assumed that the class of the argument is RecordToken.

Overrides:
_multiply in class RecordToken
Parameters:
rightArgument - The token to multiply this token by.
Returns:
A new RecordToken.
Throws:
IllegalActionException - If calling the multiply method on one of the record fields throws it.

_subtract

protected Token _subtract(Token rightArgument)
                   throws IllegalActionException
Description copied from class: RecordToken
Return a new token whose value is the field-wise subtraction of this token and the argument. It is assumed that the class of the argument is RecordToken.

Overrides:
_subtract in class RecordToken
Parameters:
rightArgument - The token to subtract from this token.
Returns:
A new RecordToken.
Throws:
IllegalActionException - If calling the subtract method on one of the record fields throws it.