Package ptolemy.actor.lib.conversions
Class ExpressionToToken
- java.lang.Object
- 
- ptolemy.kernel.util.NamedObj
- 
- ptolemy.kernel.InstantiableNamedObj
- 
- ptolemy.kernel.Entity<T>
- 
- ptolemy.kernel.ComponentEntity<T>
- 
- ptolemy.actor.AtomicActor<TypedIOPort>
- 
- ptolemy.actor.TypedAtomicActor
- 
- ptolemy.actor.lib.Transformer
- 
- ptolemy.actor.lib.conversions.Converter
- 
- ptolemy.actor.lib.conversions.ExpressionToToken
 
 
 
 
 
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- Actor,- Executable,- FiringsRecordable,- Initializable,- TypedActor,- Changeable,- Debuggable,- DebugListener,- Derivable,- Instantiable,- ModelErrorHandler,- MoMLExportable,- Moveable,- Nameable
 
 public class ExpressionToToken extends Converter This actor reads a string expression from the input port and outputs the token resulting from the evaluation. The type of the output port is by default undeclared. To use this actor, you may need to declare the output type. Depending on how the output is used, if backward type resolution is enabled in the model (the default, see the parameters of the top-level model), then the type will resolve to the most general type acceptable to the downstream actors. If the downstream actors all propagate type constraints backwards, then it might be possible for the output type to be inferred. If backward type resolution is not enabled, then you will always need to set the type of the output port to the type of the expression that is expected. If the input string parses to something that does not match the specified output data type, then a run-time type check error will occur when this actor tries to produce its output.The expression input can refer to any variable that is in scope for this actor. - Since:
- Ptolemy II 2.1
- Version:
- $Id$
- Author:
- Steve Neuendorffer
- Pt.AcceptedRating:
- Red (liuj)
- Pt.ProposedRating:
- Yellow (neuendor)
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class ptolemy.kernel.EntityEntity.ContainedObjectsIterator
 
- 
 - 
Field Summary- 
Fields inherited from class ptolemy.actor.lib.Transformerinput, output
 - 
Fields inherited from class ptolemy.actor.TypedAtomicActor_typesValid
 - 
Fields inherited from class ptolemy.actor.AtomicActor_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
 - 
Fields inherited from class ptolemy.kernel.util.NamedObj_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 - 
Fields inherited from interface ptolemy.actor.ExecutableCOMPLETED, NOT_READY, STOP_ITERATING
 
- 
 - 
Constructor SummaryConstructors Constructor Description ExpressionToToken(CompositeEntity container, java.lang.String name)Construct an actor with the given container and name.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfire()Output a token that results from evaluating the expression given by the input string token.booleanprefire()Return true if and only if an input is present.voidwrapup()Wrapup execution of this actor.- 
Methods inherited from class ptolemy.actor.TypedAtomicActor_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
 - 
Methods inherited from class ptolemy.actor.AtomicActor_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
 - 
Methods inherited from class ptolemy.kernel.ComponentEntity_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
 - 
Methods inherited from class ptolemy.kernel.Entity_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
 - 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 - 
Methods inherited from class ptolemy.kernel.util.NamedObj_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
 - 
Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface ptolemy.actor.ActorcreateReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 - 
Methods inherited from interface ptolemy.kernel.util.DerivablegetDerivedLevel, getDerivedList, propagateValue
 - 
Methods inherited from interface ptolemy.actor.ExecutableisFireFunctional, isStrict, iterate, postfire, stop, stopFire, terminate
 - 
Methods inherited from interface ptolemy.actor.InitializableaddInitializable, initialize, preinitialize, removeInitializable
 - 
Methods inherited from interface ptolemy.kernel.util.Nameabledescription, getContainer, getDisplayName, getFullName, getName, getName, setName
 
- 
 
- 
- 
- 
Constructor Detail- 
ExpressionToTokenpublic ExpressionToToken(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException Construct an actor with the given container and name.- Parameters:
- container- The container.
- name- The name of this actor.
- Throws:
- IllegalActionException- If the actor cannot be contained by the proposed container.
- NameDuplicationException- If the container already has an actor with this name.
 
 
- 
 - 
Method Detail- 
firepublic void fire() throws IllegalActionExceptionOutput a token that results from evaluating the expression given by the input string token.- Specified by:
- firein interface- Executable
- Overrides:
- firein class- AtomicActor<TypedIOPort>
- Throws:
- IllegalActionException- If there is no director, or if the expression read from the input cannot be parsed.
 
 - 
prefirepublic boolean prefire() throws IllegalActionExceptionReturn true if and only if an input is present.- Specified by:
- prefirein interface- Executable
- Overrides:
- prefirein class- AtomicActor<TypedIOPort>
- Returns:
- True if this actor is ready for firing, false otherwise.
- Throws:
- IllegalActionException- If there is no director, or if no connection has been made to the input.
 
 - 
wrapuppublic void wrapup() Wrapup execution of this actor. This method overrides the base class to discard the internal parser to save memory.- Specified by:
- wrapupin interface- Initializable
- Overrides:
- wrapupin class- AtomicActor<TypedIOPort>
 
 
- 
 
-