Package ptolemy.data
Class ActorToken
- java.lang.Object
-
- ptolemy.data.Token
-
- ptolemy.data.ActorToken
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ActorToken extends Token implements java.lang.Cloneable
A token that contains an actor. This token allows components to be moved around in a model. One subtlety is that actors are not, generally immutable objects. In order to prevent the actor transmitted from appearing in multiple places in a model, and the semantic fuzziness that would result, the actor is always cloned when being retrieved from this token.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Steve Neuendorffer
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Constructor Summary
Constructors Constructor Description ActorToken(Entity entity)
Construct an ActorToken.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Entity
getEntity()
Return a clone of the entity contained by this token.Entity
getEntity(Workspace workspace)
Return a clone of the entity contained by this token.void
getMoML(java.io.Writer output)
Output the MoML of the enclosed entity to the given writer.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 token)
Model for equality of the values of this Token and the argument Token.java.lang.String
toString()
Return the value of this token as a string that can be parsed by the expression language to recover a token with the same value.-
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
-
-
-
-
Field Detail
-
EMPTY
public static final ActorToken EMPTY
Empty Entity instance of this token.
-
TYPE
public static final Type TYPE
Singleton reference to this type.
-
-
Constructor Detail
-
ActorToken
public ActorToken(Entity entity) throws IllegalActionException
Construct an ActorToken.- Parameters:
entity
- The entity that this Token contains.- Throws:
IllegalActionException
- If cloning the entity fails.
-
-
Method Detail
-
getEntity
public Entity getEntity()
Return a clone of the entity contained by this token.- Returns:
- The clone of the entity.
-
getEntity
public Entity getEntity(Workspace workspace)
Return a clone of the entity contained by this token.- Parameters:
workspace
- The workspace that the returned entity is in.- Returns:
- The clone of the entity.
-
getMoML
public void getMoML(java.io.Writer output) throws java.io.IOException
Output the MoML of the enclosed entity to the given writer.- Parameters:
output
- The writer to which the MoML is output.- Throws:
java.io.IOException
- If an I/O error occurs.
-
getType
public Type getType()
Return the type of this token.
-
isCloseTo
public BooleanToken isCloseTo(Token rightArgument, double epsilon) throws IllegalActionException
Test for closeness of the values of this Token and the argument Token. For actor tokens, checking for closeness is the same as checking for equality.- Overrides:
isCloseTo
in classToken
- Parameters:
rightArgument
- The token to compare to this token.epsilon
- This argument is ignored in this method.- Returns:
- A true-valued token if the first argument is equal to this token.
- Throws:
IllegalActionException
- If thrown byisEqualTo(Token)
.
-
isEqualTo
public BooleanToken isEqualTo(Token token) throws IllegalActionException
Model for equality of the values of this Token and the argument Token. It should be overridden in derived classes to provide type specific actions for equality testing.- Overrides:
isEqualTo
in classToken
- Parameters:
token
- The token with which to test equality.- Returns:
- A BooleanToken which contains the result of the test.
- Throws:
IllegalActionException
- If this method is not supported by the derived class.
-
toString
public java.lang.String toString()
Return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. This method returns a string of the form `parseMoML("text")', where text is a MoML description of this actor with quotation marks and backslashes escaped.
-
-