ptolemy.actor.gt
Class AttributeMatcher

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.gt.AttributeMatcher
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, GTEntity, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class AttributeMatcher
extends Attribute
implements GTEntity

A matcher to match any attribute. In the pattern of a TransformationRule, this matcher can be customized by instances of Criterion. In the replacement of a TransformationRule, operations can be specified for this matcher with instances of Operation. The operations will be performed on the attribute that is matched by the corresponding matcher in the pattern, and is preserved after the transformation.

Since:
Ptolemy II 8.0
Version:
$Id: AttributeMatcher.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Thomas Huining Feng
See Also:
Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private static java.lang.String _ICON_DESCRIPTION
          The default icon description.
private  java.util.Set<java.lang.String> _labelSet
          Cache of the label set.
private  long _version
          The workspace version the last time when _labelSet was updated.
 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.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
AttributeMatcher(NamedObj container, java.lang.String name)
          Construct an attribute matcher to be either contained in the pattern of a TransformationRule or in the replacement.
 
Method Summary
 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 AtomicActorMatcher can match the given object.
 void updateAppearance(GTIngredientsAttribute attribute)
          Do nothing.
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, 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.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.


_ICON_DESCRIPTION

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

See Also:
Constant Field Values

_labelSet

private java.util.Set<java.lang.String> _labelSet
Cache of the label set.


_version

private long _version
The workspace version the last time when _labelSet was updated.

Constructor Detail

AttributeMatcher

public AttributeMatcher(NamedObj container,
                        java.lang.String name)
                 throws IllegalActionException,
                        NameDuplicationException
Construct an attribute 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 stores 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 AtomicActorMatcher 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 ComponentEntity.

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

updateAppearance

public void updateAppearance(GTIngredientsAttribute attribute)
Do nothing. The appearance of an AttributeMatcher is not updated with change of the criteria or operations.

Specified by:
updateAppearance in interface GTEntity
Parameters:
attribute - The attribute containing ingredients of this entity.