|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.actor.gt.GTIngredient
public abstract class GTIngredient
Superclass of criteria and operations that can be associated with entities in a transformation rule. Each GTIngredient has a number of {\em elements}. An element is essentially an entry that can hold a value and can be disabled if its value is ignored. This superclass provides common methods for defining and accessing those elements.
Red (tfeng) |
Yellow (tfeng) |
Nested Class Summary | |
---|---|
protected static class |
GTIngredient.FieldIterator
An iterator to read the fields one by one in a string that describes the values of all the elements. |
Field Summary | |
---|---|
private boolean[] |
_enablements
An array that contains a Boolean value for each element to identify whether it is enabled. |
private GTIngredientList |
_owner
The list that contains this GTIngredient. |
static char |
FIELD_SEPARATOR
The string to separate elements in a string that describes their values. |
Constructor Summary | |
---|---|
protected |
GTIngredient(GTIngredientList owner,
int elementCount)
Construct a GTIngredient within the given list as its owner containing a given number of elements. |
Method Summary | |
---|---|
protected boolean |
_decodeBooleanField(int index,
GTIngredient.FieldIterator iterator)
Decode a Boolean field and store the value into the index-th element. |
protected java.lang.String |
_decodeStringField(int index,
GTIngredient.FieldIterator iterator)
Decode a string field and store the value into the index-th element. |
protected void |
_encodeBooleanField(java.lang.StringBuffer buffer,
int index,
boolean value)
Encode a Boolean field with the given value using the enablement of the index-th element, and append the encoded string to the end of the buffer. |
protected void |
_encodeStringField(java.lang.StringBuffer buffer,
int index,
java.lang.String value)
Encode a string field with the given value using the enablement of the index-th element, and append the encoded string to the end of the buffer. |
protected static java.lang.String |
_escapeElementString(java.lang.String elementString)
Escape a string that describes the value of a single element, so that it is enclosed in quotes and between the quotes, there are no quotes (single or double) or backslashes. |
protected static int |
_findMatchingParen(java.lang.String s,
int startPos)
Find the closing parenthesis that matches the the open parenthesis at startPos position in string s. |
protected static int |
_findSeparator(java.lang.String s,
int startPos,
char separator)
Find the separator character in string s starting from position startPos. |
protected static java.lang.String |
_unescapeElementString(java.lang.String elementString)
Unescape a string that has been escaped previously from an original string that describes the value of a single element, and get back the original string. |
void |
disableAll()
Disable all elements. |
void |
enableAll()
Enable all elements. |
abstract GTIngredientElement[] |
getElements()
Get the array of elements defined in this GTIngredient. |
GTIngredientList |
getOwner()
Get the list that contains this GTIngredient. |
abstract java.lang.Object |
getValue(int index)
Get the value of the index-th elements. |
abstract 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 |
isEnabled(int index)
Check whether the index-th element is enabled. |
void |
setEnabled(int index,
boolean isEnabled)
Set the enablement of the index-th element. |
abstract void |
setValue(int index,
java.lang.Object value)
Set the value of the index-th element. |
abstract void |
setValues(java.lang.String values)
Set the values of all the elements with a string that describes them. |
java.lang.String |
toString()
Return a readable string about this GTIngredient. |
abstract void |
validate()
Validate the enablements and values of all the elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char FIELD_SEPARATOR
private boolean[] _enablements
private GTIngredientList _owner
Constructor Detail |
---|
protected GTIngredient(GTIngredientList owner, int elementCount)
owner
- The list as the owner of the constructed GTIngredientList.elementCount
- The number of elements that the GTIngredient has.Method Detail |
---|
public void disableAll()
public void enableAll()
public abstract GTIngredientElement[] getElements()
public GTIngredientList getOwner()
public abstract java.lang.Object getValue(int index)
index
- The index.
setValue(int, Object)
public abstract java.lang.String getValues()
setValues(String)
public boolean isApplicable(NamedObj object)
object
- The object.
public boolean isEnabled(int index)
index
- The index.
setEnabled(int, boolean)
public void setEnabled(int index, boolean isEnabled)
index
- The index.isEnabled
- true if the element is set to be enabled; false if it
is disabled.isEnabled(int)
public abstract void setValue(int index, java.lang.Object value)
index
- The index.value
- The value.getValue(int)
public abstract void setValues(java.lang.String values)
values
- A string that describes the new values of all the
elements.getValues()
public java.lang.String toString()
toString
in class java.lang.Object
public abstract void validate() throws ValidationException
ValidationException
- If some elements are invalid.protected boolean _decodeBooleanField(int index, GTIngredient.FieldIterator iterator)
index
- The index.iterator
- The iterator used to iterate over all fields in a string
describing all the values.
protected java.lang.String _decodeStringField(int index, GTIngredient.FieldIterator iterator)
index
- The index.iterator
- The iterator used to iterate over all fields in a string
describing all the values.
protected void _encodeBooleanField(java.lang.StringBuffer buffer, int index, boolean value)
buffer
- The buffer.index
- The index.value
- The value to be encoded.protected void _encodeStringField(java.lang.StringBuffer buffer, int index, java.lang.String value)
buffer
- The buffer.index
- The index.value
- The value to be encoded.protected static java.lang.String _escapeElementString(java.lang.String elementString)
elementString
- The string to be escaped.
_unescapeElementString(String)
protected static int _findMatchingParen(java.lang.String s, int startPos)
s
- The string.startPos
- The position of the open parenthesis to be matched.
protected static int _findSeparator(java.lang.String s, int startPos, char separator)
s
- The string.startPos
- The start position.separator
- The separator charactor.
protected static java.lang.String _unescapeElementString(java.lang.String elementString)
elementString
- The string to be unescaped.
_escapeElementString(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |