Class DynamicAttributeOperation
- java.lang.Object
-
- ptolemy.actor.gt.GTIngredient
-
- ptolemy.actor.gt.ingredients.operations.Operation
-
- ptolemy.actor.gt.ingredients.operations.DynamicAttributeOperation
-
public class DynamicAttributeOperation extends Operation
An operation to add or change an attribute.- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Yellow (tfeng)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.actor.gt.GTIngredient
GTIngredient.FieldIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.actor.gt.ingredients.operations.Operation
_parseTreeWriter
-
Fields inherited from class ptolemy.actor.gt.GTIngredient
FIELD_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description DynamicAttributeOperation(GTIngredientList owner)
Construct an operation within the given list as its owner.DynamicAttributeOperation(GTIngredientList owner, java.lang.String values)
Construct an operation within the given list as its owner and initialize all the elements with the given values, which are a string encoding of those elements.DynamicAttributeOperation(GTIngredientList owner, java.lang.String attributeName, java.lang.String attributeClass, java.lang.String attributeValue)
Construct an operation within the given list as its owner and with the given value to each of its elements..
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_reparse()
Generate the parse tree for the attributeValue element again.ChangeRequest
getChangeRequest(Pattern pattern, Replacement replacement, MatchResult matchResult, NamedObj patternObject, NamedObj replacementObject, NamedObj hostObject)
Get the change request to update the object in the host model.GTIngredientElement[]
getElements()
Get the array of elements defined in this GTIngredient.java.lang.Object
getValue(int index)
Get the value of the index-th elements.java.lang.String
getValues()
Get a string that describes the values of all the elements.boolean
isAttributeClassEnabled()
Return whether the attributeClass element is enabled.boolean
isAttributeNameEnabled()
Return whether the attributeName element is enabled.boolean
isAttributeValueEnabled()
Return whether the attributeValue element is enabled.void
setAttributeClass(java.lang.String attributeClass)
Set the value of the attributeClass element.void
setAttributeName(java.lang.String attributeName)
Set the value of the attributeName element.void
setAttributeValue(java.lang.String attributeValue)
Set the value of the attributeValue element.void
setValue(int index, java.lang.Object value)
Set the value of the index-th element.void
setValues(java.lang.String values)
Set the values of all the elements with a string that describes them.void
validate()
Validate the enablements and values of all the elements.-
Methods inherited from class ptolemy.actor.gt.GTIngredient
_decodeBooleanField, _decodeStringField, _encodeBooleanField, _encodeStringField, _escapeElementString, _findMatchingParen, _findSeparator, _unescapeElementString, disableAll, enableAll, getOwner, isApplicable, isEnabled, setEnabled, toString
-
-
-
-
Constructor Detail
-
DynamicAttributeOperation
public DynamicAttributeOperation(GTIngredientList owner)
Construct an operation within the given list as its owner. All elements are enabled and are initialized to empty at the beginning.- Parameters:
owner
- The list as the owner of the constructed GTIngredientList.
-
DynamicAttributeOperation
public DynamicAttributeOperation(GTIngredientList owner, java.lang.String values)
Construct an operation within the given list as its owner and initialize all the elements with the given values, which are a string encoding of those elements. All elements are enabled at the beginning.- Parameters:
owner
- The list as the owner of the constructed GTIngredientList.values
- The string encoding of the values of the elements.
-
DynamicAttributeOperation
public DynamicAttributeOperation(GTIngredientList owner, java.lang.String attributeName, java.lang.String attributeClass, java.lang.String attributeValue)
Construct an operation within the given list as its owner and with the given value to each of its elements..- Parameters:
owner
- The list as the owner of the constructed GTIngredientList.attributeName
- Value of the attributeName element.attributeClass
- Value of the attributeClass element.attributeValue
- Value of the attributeValue element.
-
-
Method Detail
-
getChangeRequest
public ChangeRequest getChangeRequest(Pattern pattern, Replacement replacement, MatchResult matchResult, NamedObj patternObject, NamedObj replacementObject, NamedObj hostObject) throws IllegalActionException
Get the change request to update the object in the host model.- Specified by:
getChangeRequest
in classOperation
- Parameters:
pattern
- The pattern of the transformation rule.replacement
- The replacement of the transformation rule.matchResult
- The match result.patternObject
- The object in the pattern, or null.replacementObject
- The object in the replacement that corresponds to the object in the pattern.hostObject
- The object in the host model corresponding to the object in the replacement.- Returns:
- The change request.
- Throws:
IllegalActionException
- If error occurs in generating the change request.
-
getElements
public GTIngredientElement[] getElements()
Get the array of elements defined in this GTIngredient.- Specified by:
getElements
in classGTIngredient
- Returns:
- The array of elements.
-
getValue
public java.lang.Object getValue(int index)
Get the value of the index-th elements.- Specified by:
getValue
in classGTIngredient
- Parameters:
index
- The index.- Returns:
- The value.
- See Also:
setValue(int, Object)
-
getValues
public java.lang.String getValues()
Get a string that describes the values of all the elements.- Specified by:
getValues
in classGTIngredient
- Returns:
- A string that describes the values of all the elements.
- See Also:
setValues(String)
-
isAttributeClassEnabled
public boolean isAttributeClassEnabled()
Return whether the attributeClass element is enabled.- Returns:
- true if the attributeClass element is enabled.
-
isAttributeNameEnabled
public boolean isAttributeNameEnabled()
Return whether the attributeName element is enabled.- Returns:
- true if the attributeName element is enabled.
-
isAttributeValueEnabled
public boolean isAttributeValueEnabled()
Return whether the attributeValue element is enabled.- Returns:
- true if the attributeValue element is enabled.
-
setAttributeClass
public void setAttributeClass(java.lang.String attributeClass)
Set the value of the attributeClass element.- Parameters:
attributeClass
- The value of the attributeClass element.
-
setAttributeName
public void setAttributeName(java.lang.String attributeName)
Set the value of the attributeName element.- Parameters:
attributeName
- The value of the attributeName element.
-
setAttributeValue
public void setAttributeValue(java.lang.String attributeValue)
Set the value of the attributeValue element.- Parameters:
attributeValue
- The value of the attributeValue element.
-
setValue
public void setValue(int index, java.lang.Object value)
Set the value of the index-th element.- Specified by:
setValue
in classGTIngredient
- Parameters:
index
- The index.value
- The value.- See Also:
getValue(int)
-
setValues
public void setValues(java.lang.String values)
Set the values of all the elements with a string that describes them.- Specified by:
setValues
in classGTIngredient
- Parameters:
values
- A string that describes the new values of all the elements.- See Also:
getValues()
-
validate
public void validate() throws ValidationException
Validate the enablements and values of all the elements.- Specified by:
validate
in classGTIngredient
- Throws:
ValidationException
- If some elements are invalid.
-
_reparse
protected void _reparse() throws IllegalActionException
Generate the parse tree for the attributeValue element again.- Throws:
IllegalActionException
- If error occurs in the parse tree generation.
-
-