Package ptolemy.actor.gt
Class StateMatcher
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity
-
- ptolemy.domains.modal.kernel.State
-
- ptolemy.actor.gt.StateMatcher
-
- All Implemented Interfaces:
java.lang.Cloneable,Actor,Executable,GTEntity,Initializable,TypedActor,ConfigurableEntity,Changeable,Configurable,Debuggable,DebugListener,Derivable,DropTargetHandler,Flowable,Instantiable,ModelErrorHandler,MoMLExportable,Moveable,Nameable,ValueListener
public class StateMatcher extends State implements GTEntity, TypedActor, ValueListener
A matcher to match a state in an FSM controller or an event in a Ptera controller.- Since:
- Ptolemy II 6.1
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Yellow (tfeng)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description GTIngredientsAttributecriteriaThe attribute containing all the criteria in a list (GTIngredientList).GTIngredientsEditor.FactoryeditorFactoryThe editor factory for ingredients in this matcher.GTIngredientsAttributeoperationsThe attribute containing all the operations in a list (GTIngredientList).PatternObjectAttributepatternObjectThe attribute that specifies the name of the corresponding entity in the pattern.-
Fields inherited from class ptolemy.domains.modal.kernel.State
incomingPort, isFinalState, isInitialState, outgoingPort, refinementName, saveRefinementsInConfigurer
-
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.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description StateMatcher(CompositeEntity container, java.lang.String name)Construct a state with the given name contained by the specified composite entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInitializable(Initializable initializable)Do nothing because a state matcher is not supposed to contain any initializable.java.lang.Objectclone(Workspace workspace)Clone the actor into the specified workspace.voidcreateReceivers()Create receivers for all necessary ports.voidfire()Do nothing.CausalityInterfacegetCausalityInterface()Return a causality interface for this actor.GTIngredientsAttributegetCriteriaAttribute()Return the attribute that stores all the criteria for this matcher.java.lang.StringgetDefaultIconDescription()Return null.DirectorgetDirector()Return null.DirectorgetExecutiveDirector()Return null.ManagergetManager()Return null.GTIngredientsAttributegetOperationsAttribute()Return the attribute that stores all the operations for this matcher.PatternObjectAttributegetPatternObjectAttribute()Return the attribute that stores the name of the corresponding entity in the pattern of the sameTransformationRule, if this entity is in the replacement, or null otherwise.voidinitialize()Do nothing.java.util.List<?>inputPortList()Return an empty list.booleanisBackwardTypeInferenceEnabled()Return false because backward type inference is not implemented for this actor.booleanisFireFunctional()Return true because prefire and fire do nothing.booleanisStrict()Return false.intiterate(int count)Do nothing and return 0.java.util.Set<java.lang.String>labelSet()Return the set of names of ingredients contained in this entity that can be resolved.booleanmatch(NamedObj object)Return true if the given object is an instance of State (either the one in the deprecated FSM domain or the one in modal model since Ptolemy 8.0).ReceivernewReceiver()Return null.java.util.List<?>outputPortList()Return an empty list.booleanpostfire()Do nothing and return false.booleanprefire()Do nothing and return false.voidpreinitialize()Do nothing.voidremoveInitializable(Initializable initializable)Do nothing.voidsetContainer(CompositeEntity container)Specify the container, adding the entity to the list of entities in the container.voidstop()Do nothing.voidstopFire()Do nothing.voidterminate()Do nothing.java.util.Set<Inequality>typeConstraints()Return an empty list.voidupdateAppearance(GTIngredientsAttribute attribute)Update appearance of this entity.voidvalueChanged(Settable settable)React to the fact that the specified Settable has changed.voidwrapup()Do nothing.-
Methods inherited from class ptolemy.domains.modal.kernel.State
_exportMoMLContents, attributeChanged, configure, dropObject, errorTransitionList, getConfigurer, getConfigureSource, getConfigureText, getIncomingPort, getObjectInRefinement, getOutgoingPort, getRefinement, nonErrorNonTerminationTransitionList, nonpreemptiveTransitionList, preemptiveTransitionList, terminationTransitionList
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _removePort, _validateSettables, connectedPortList, connectedPorts, connectionsChanged, 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, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, 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.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
criteria
public GTIngredientsAttribute criteria
The attribute containing all the criteria in a list (GTIngredientList).
-
editorFactory
public GTIngredientsEditor.Factory editorFactory
The editor factory for ingredients in this matcher.
-
operations
public GTIngredientsAttribute operations
The attribute containing all the operations in a list (GTIngredientList).
-
patternObject
public PatternObjectAttribute patternObject
The attribute that specifies the name of the corresponding entity in the pattern.
-
-
Constructor Detail
-
StateMatcher
public StateMatcher(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct a state with the given name contained by the specified composite entity. The container argument must not be null, or a NullPointerException will be thrown. This state will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace. This constructor write-synchronizes on the workspace.- Parameters:
container- The container.name- The name of the state.- Throws:
IllegalActionException- If the state cannot be contained by the proposed container.NameDuplicationException- If the name coincides with that of an entity already in the container.
-
-
Method Detail
-
addInitializable
public void addInitializable(Initializable initializable)
Do nothing because a state matcher is not supposed to contain any initializable.- Specified by:
addInitializablein interfaceInitializable- Parameters:
initializable- The initializable.- See Also:
Initializable.removeInitializable(Initializable)
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the actor into the specified workspace. Set a type constraint that the output type is the same as the that of input.- Overrides:
clonein classState- Parameters:
workspace- The workspace for the new object.- Returns:
- A new actor.
- Throws:
java.lang.CloneNotSupportedException- If a derived class has has an attribute that cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String),NamedObj.setDeferringChangeRequests(boolean)
-
createReceivers
public void createReceivers() throws IllegalActionExceptionCreate receivers for all necessary ports. In this implementation no receivers will be created- Specified by:
createReceiversin interfaceActor- Throws:
IllegalActionException- If any port throws it.- See Also:
AtomicActor.createReceivers(),CompositeActor.createReceivers()
-
fire
public void fire() throws IllegalActionExceptionDo nothing.- Specified by:
firein interfaceExecutable- Throws:
IllegalActionException- Not thrown in this class.
-
getCausalityInterface
public CausalityInterface getCausalityInterface()
Return a causality interface for this actor. In this base class, if there is a director, we delegate to the director to return a default causality interface. Otherwise, we return an instance of CausalityInterface with BooleanDependency.OTIMES_IDENTITY as its default. This declares the dependency between input ports and output ports of an actor to be true, the multiplicative identity. If this is called multiple times, the same object is returned each time unless the director has changed since the last call, in which case a new object is returned.- Specified by:
getCausalityInterfacein interfaceActor- Returns:
- A representation of the dependencies between input ports and output ports.
-
getCriteriaAttribute
public GTIngredientsAttribute getCriteriaAttribute()
Return the attribute that stores all the criteria for this matcher.- Specified by:
getCriteriaAttributein interfaceGTEntity- Returns:
- The attribute that stores all the criteria.
-
getDefaultIconDescription
public java.lang.String getDefaultIconDescription()
Return null.- Specified by:
getDefaultIconDescriptionin interfaceGTEntity- Returns:
- null.
-
getDirector
public Director getDirector()
Return null.- Specified by:
getDirectorin interfaceActor- Returns:
- null.
-
getExecutiveDirector
public Director getExecutiveDirector()
Return null.- Specified by:
getExecutiveDirectorin interfaceActor- Returns:
- null.
-
getManager
public Manager getManager()
Return null.- Specified by:
getManagerin interfaceActor- Returns:
- null.
-
getOperationsAttribute
public GTIngredientsAttribute getOperationsAttribute()
Return the attribute that stores all the operations for this matcher.- Specified by:
getOperationsAttributein interfaceGTEntity- Returns:
- The attribute that stores all the operations.
-
getPatternObjectAttribute
public PatternObjectAttribute getPatternObjectAttribute()
Return the attribute that stores the name of the corresponding entity in the pattern of the sameTransformationRule, if this entity is in the replacement, or null otherwise.- Specified by:
getPatternObjectAttributein interfaceGTEntity- Returns:
- The attribute that stores the name of the corresponding entity.
- See Also:
labelSet()
-
initialize
public void initialize() throws IllegalActionExceptionDo nothing.- Specified by:
initializein interfaceInitializable- Throws:
IllegalActionException- Not thrown in this class.
-
inputPortList
public java.util.List<?> inputPortList()
Return an empty list.- Specified by:
inputPortListin interfaceActor- Returns:
- An empty list.
-
isBackwardTypeInferenceEnabled
public boolean isBackwardTypeInferenceEnabled()
Return false because backward type inference is not implemented for this actor.- Specified by:
isBackwardTypeInferenceEnabledin interfaceTypedActor- Returns:
- false
-
isFireFunctional
public boolean isFireFunctional()
Return true because prefire and fire do nothing.- Specified by:
isFireFunctionalin interfaceExecutable- Returns:
- true.
-
isStrict
public boolean isStrict()
Return false.- Specified by:
isStrictin interfaceExecutable- Returns:
- false.
-
iterate
public int iterate(int count) throws IllegalActionExceptionDo nothing and return 0.- Specified by:
iteratein interfaceExecutable- Parameters:
count- The number of iteration.- Returns:
- 0
- Throws:
IllegalActionException- Not thrown in this class.
-
labelSet
public java.util.Set<java.lang.String> labelSet()
Return the set of names of ingredients contained in this entity that can be resolved.
-
match
public boolean match(NamedObj object)
Return true if the given object is an instance of State (either the one in the deprecated FSM domain or the one in modal model since Ptolemy 8.0).
-
newReceiver
public Receiver newReceiver() throws IllegalActionException
Return null.- Specified by:
newReceiverin interfaceActor- Returns:
- null.
- Throws:
IllegalActionException- Not thrown in this class.
-
outputPortList
public java.util.List<?> outputPortList()
Return an empty list.- Specified by:
outputPortListin interfaceActor- Returns:
- An empty list.
-
postfire
public boolean postfire() throws IllegalActionExceptionDo nothing and return false.- Specified by:
postfirein interfaceExecutable- Returns:
- false
- Throws:
IllegalActionException- Not thrown in this class.
-
prefire
public boolean prefire() throws IllegalActionExceptionDo nothing and return false.- Specified by:
prefirein interfaceExecutable- Returns:
- false
- Throws:
IllegalActionException- Not thrown in this class.
-
preinitialize
public void preinitialize() throws IllegalActionExceptionDo nothing.- Specified by:
preinitializein interfaceInitializable- Throws:
IllegalActionException- Not thrown in this class.
-
removeInitializable
public void removeInitializable(Initializable initializable)
Do nothing.- Specified by:
removeInitializablein interfaceInitializable- Parameters:
initializable- The initializable.- See Also:
Initializable.addInitializable(Initializable)
-
setContainer
public void setContainer(CompositeEntity container) throws IllegalActionException, NameDuplicationException
Specify the container, adding the entity to the list of entities in the container. If the container already contains an entity with the same name, then throw an exception and do not make any changes. Similarly, if the container is not in the same workspace as this entity, throw an exception. If this entity is a class element and the proposed container does not match the current container, then also throw an exception. If the entity is already contained by the container, do nothing. If this entity already has a container, remove it from that container first. Otherwise, remove it from the directory of the workspace, if it is present. If the argument is null, then unlink the ports of the entity from any relations and remove it from its container. It is not added to the workspace directory, so this could result in this entity being garbage collected. Derived classes may further constrain the container to subclasses of CompositeEntity by overriding the protected method _checkContainer(). This method validates all deeply contained instances of Settable, since they may no longer be valid in the new context. This method is write-synchronized to the workspace and increments its version number.- Overrides:
setContainerin classComponentEntity- Parameters:
container- The proposed container.- Throws:
IllegalActionException- If the action would result in a recursive containment structure, or if this entity and container are not in the same workspace, or if the protected method _checkContainer() throws it, or if a contained Settable becomes invalid and the error handler throws it.NameDuplicationException- If the name of this entity collides with a name already in the container.- See Also:
ComponentEntity.getContainer()
-
stop
public void stop()
Do nothing.- Specified by:
stopin interfaceExecutable
-
stopFire
public void stopFire()
Do nothing.- Specified by:
stopFirein interfaceExecutable
-
terminate
public void terminate()
Do nothing.- Specified by:
terminatein interfaceExecutable
-
typeConstraints
public java.util.Set<Inequality> typeConstraints() throws IllegalActionException
Return an empty list.- Specified by:
typeConstraintsin interfaceTypedActor- Returns:
- An empty list.
- Throws:
IllegalActionException- Not thrown in this class.- See Also:
Inequality
-
updateAppearance
public void updateAppearance(GTIngredientsAttribute attribute)
Update appearance of this entity.- Specified by:
updateAppearancein interfaceGTEntity- Parameters:
attribute- The attribute containing ingredients of this entity.- See Also:
GTEntityUtils.updateAppearance(GTEntity, GTIngredientsAttribute)
-
valueChanged
public void valueChanged(Settable settable)
React to the fact that the specified Settable has changed.- Specified by:
valueChangedin interfaceValueListener- Parameters:
settable- The object that has changed value.- See Also:
GTEntityUtils.valueChanged(GTEntity, Settable)
-
wrapup
public void wrapup() throws IllegalActionExceptionDo nothing.- Specified by:
wrapupin interfaceInitializable- Throws:
IllegalActionException- Not thrown in this class.
-
-