ptolemy.actor.gt
Class CompositeActorMatcher

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.InstantiableNamedObj
          extended by ptolemy.kernel.Entity
              extended by ptolemy.kernel.ComponentEntity
                  extended by ptolemy.kernel.CompositeEntity
                      extended by ptolemy.actor.CompositeActor
                          extended by ptolemy.actor.TypedCompositeActor
                              extended by ptolemy.actor.gt.CompositeActorMatcher
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, GTCompositeActor, GTEntity, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, ValueListener
Direct Known Subclasses:
ModalModelMatcher, Pattern, Replacement

public class CompositeActorMatcher
extends TypedCompositeActor
implements GTCompositeActor, GTEntity, ValueListener

A matcher to match a level of hierarchy in a hierarchical model. In the pattern of a TransformationRule, this matcher can be customized by instances of Criterion. A PortCriterion, for instance, customizes this matcher with an additional port, whose type and name can be specified. In the replacement of a TransformationRule, operations can be specified for this matcher with instances of Operation. The operations will be performed on the actor that is matched by the corresponding matcher in the pattern, and is preserved after the transformation.

Since:
Ptolemy II 7.1
Version:
$Id: CompositeActorMatcher.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Thomas Huining Feng
See Also:
AtomicActorMatcher, Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
private static java.lang.String _ICON_DESCRIPTION
          The default icon description.
 GTIngredientsAttribute criteria
          The attribute containing all the criteria in a list (GTIngredientList).
 GTIngredientsEditor.Factory editorFactory
          The editor factory for ingredients in this matcher.
 GTIngredientsAttribute operations
          The attribute containing all the operations in a list (GTIngredientList).
 PatternObjectAttribute patternObject
          The attribute that specifies the name of the corresponding entity in the pattern.
 
Fields inherited from class ptolemy.actor.CompositeActor
_actorFiringListeners, _causalityInterface, _initializables, _notifyingActorFiring, _publishedPorts, _publisherRelations, _stopRequested
 
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _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
CompositeActorMatcher(CompositeEntity container, java.lang.String name)
          Construct an atomic actor matcher to be either contained in the pattern of a TransformationRule or in the replacement.
 
Method Summary
protected  void _exportMoMLContents(java.io.Writer output, int depth)
          Write a MoML description of the contents of this object, which in this class are the attributes plus the ports.
 GTIngredientsAttribute getCriteriaAttribute()
          Return the attribute that stores all the criteria for this matcher.
 java.lang.String getDefaultIconDescription()
          Return a string that contains the SVG icon description ("<svg>...
 GTIngredientsAttribute getOperationsAttribute()
          Return the attribute that stores all the operations for this matcher.
 PatternObjectAttribute getPatternObjectAttribute()
          Return the attribute that stores the name of the corresponding entity in the pattern of the same TransformationRule, if this entity is in the replacement, or null otherwise.
 java.util.Set<java.lang.String> labelSet()
          Return the set of names of ingredients contained in this entity that can be resolved.
 boolean match(NamedObj object)
          Test whether this CompositeActorMatcher can match the given object.
 void updateAppearance(GTIngredientsAttribute attribute)
          Update appearance of this entity.
 void valueChanged(Settable settable)
          React to the fact that the specified Settable has changed.
 
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.CompositeActor
_actorFiring, _actorFiring, _finishedAddEntity, _getPublishedPort, _setDirector, addActorFiringListener, addInitializable, addPiggyback, clone, connectionsChanged, createReceivers, createSchedule, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, preinitialize, recordFiring, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, wrapup
 
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _deepOpaqueEntityList, _description, _recordDecoratedAttributes, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allCompositeEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, 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, propagateValue, propagateValues, removeChangeListener, removeDebugListener, 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.actor.TypedActor
typeConstraints
 
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
 
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, initialize, preinitialize, removeInitializable, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 

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.


_ICON_DESCRIPTION

private static final java.lang.String _ICON_DESCRIPTION
The default icon description.

See Also:
Constant Field Values
Constructor Detail

CompositeActorMatcher

public CompositeActorMatcher(CompositeEntity container,
                             java.lang.String name)
                      throws IllegalActionException,
                             NameDuplicationException
Construct an atomic actor matcher to be either contained in the pattern of a TransformationRule or in the replacement.

Parameters:
container - The proposed container of this matcher.
name - The name of this matcher.
Throws:
IllegalActionException - If this actor cannot be contained by the proposed container.
NameDuplicationException - If the name coincides with an entity already in the container.
Method Detail

getCriteriaAttribute

public GTIngredientsAttribute getCriteriaAttribute()
Return the attribute that stores all the criteria for this matcher.

Specified by:
getCriteriaAttribute in interface GTEntity
Returns:
The attribute that stores all the criteria.

getDefaultIconDescription

public java.lang.String getDefaultIconDescription()
Return a string that contains the SVG icon description ("<svg>...</svg>") for this matcher. This icon description is the default icon for the matcher, which may be changed by the criteria.

Specified by:
getDefaultIconDescription in interface GTEntity
Returns:
The icon description.

getOperationsAttribute

public GTIngredientsAttribute getOperationsAttribute()
Return the attribute that stores all the operations for this matcher.

Specified by:
getOperationsAttribute in interface GTEntity
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 same TransformationRule, if this entity is in the replacement, or null otherwise.

Specified by:
getPatternObjectAttribute in interface GTEntity
Returns:
The attribute that stires the name of the corresponding entity.
See Also:
labelSet()

labelSet

public java.util.Set<java.lang.String> labelSet()
Return the set of names of ingredients contained in this entity that can be resolved.

Specified by:
labelSet in interface GTEntity
Returns:
The set of names.

match

public boolean match(NamedObj object)
Test whether this CompositeActorMatcher can match the given object. The matching is shallow in the sense that objects contained by this matcher need not match the corresponding objects in the given object for the return result to be true. The return result is true if and only if the given object is an instance of CompositeEntity.

Specified by:
match in interface GTEntity
Parameters:
object - The NamedObj.
Returns:
Whether this CompositeActorMatcher can match the given object.

updateAppearance

public void updateAppearance(GTIngredientsAttribute attribute)
Update appearance of this entity.

Specified by:
updateAppearance in interface GTEntity
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:
valueChanged in interface ValueListener
Parameters:
settable - The object that has changed value.
See Also:
GTEntityUtils.valueChanged(GTEntity, Settable)

_exportMoMLContents

protected void _exportMoMLContents(java.io.Writer output,
                                   int depth)
                            throws java.io.IOException
Write a MoML description of the contents of this object, which in this class are the attributes plus the ports. This method is called by exportMoML(). Each description is indented according to the specified depth and terminated with a newline character.

Overrides:
_exportMoMLContents in class CompositeEntity
Parameters:
output - The output to write to.
depth - The depth in the hierarchy, to determine indenting.
Throws:
java.io.IOException - If an I/O error occurs.
See Also:
NamedObj.exportMoML(Writer, int)