ptolemy.actor.gt.ingredients.operations
Class PortRemovalOperation

java.lang.Object
  extended by ptolemy.actor.gt.GTIngredient
      extended by ptolemy.actor.gt.ingredients.operations.Operation
          extended by ptolemy.actor.gt.ingredients.operations.PortRemovalOperation

public class PortRemovalOperation
extends Operation

An operation to remove a port.

Since:
Ptolemy II 8.0
Version:
$Id: PortRemovalOperation.java 54815 2009-06-30 05:18:27Z tfeng $
Author:
Thomas Huining Feng
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.actor.gt.GTIngredient
GTIngredient.FieldIterator
 
Field Summary
private static OperationElement[] _ELEMENTS
          The elements.
private  java.lang.String _name
          Value of the port name element.
 
Fields inherited from class ptolemy.actor.gt.ingredients.operations.Operation
_parseTreeWriter
 
Fields inherited from class ptolemy.actor.gt.GTIngredient
FIELD_SEPARATOR
 
Constructor Summary
PortRemovalOperation(GTIngredientList owner)
          Construct an operation within the given list as its owner.
PortRemovalOperation(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.
 
Method Summary
 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.String getName()
          Get the port name element.
 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 isApplicable(NamedObj object)
          Check whether this GTIngredient is applicable to the object.
 boolean isNameEnabled()
          Return whether the port name element is enabled.
 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.ingredients.operations.Operation
_evaluate
 
Methods inherited from class ptolemy.actor.gt.GTIngredient
_decodeBooleanField, _decodeStringField, _encodeBooleanField, _encodeStringField, _escapeElementString, _findMatchingParen, _findSeparator, _unescapeElementString, disableAll, enableAll, getOwner, isEnabled, setEnabled, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_ELEMENTS

private static final OperationElement[] _ELEMENTS
The elements.


_name

private java.lang.String _name
Value of the port name element.

Constructor Detail

PortRemovalOperation

public PortRemovalOperation(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.

PortRemovalOperation

public PortRemovalOperation(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.
Method Detail

getChangeRequest

public 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.

Specified by:
getChangeRequest in class Operation
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.

getElements

public GTIngredientElement[] getElements()
Get the array of elements defined in this GTIngredient.

Specified by:
getElements in class GTIngredient
Returns:
The array of elements.

getName

public java.lang.String getName()
Get the port name element.

Returns:
The port name element.

getValue

public java.lang.Object getValue(int index)
Get the value of the index-th elements.

Specified by:
getValue in class GTIngredient
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 class GTIngredient
Returns:
A string that describes the values of all the elements.
See Also:
setValues(String)

isApplicable

public boolean isApplicable(NamedObj object)
Check whether this GTIngredient is applicable to the object.

Overrides:
isApplicable in class GTIngredient
Parameters:
object - The object.
Returns:
true if this GTIngredient is applicable; false otherwise.

isNameEnabled

public boolean isNameEnabled()
Return whether the port name element is enabled.

Returns:
true if the port name element is enabled.

setValue

public void setValue(int index,
                     java.lang.Object value)
Set the value of the index-th element.

Specified by:
setValue in class GTIngredient
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 class GTIngredient
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 class GTIngredient
Throws:
ValidationException - If some elements are invalid.