Class StateTypeCriterion
- java.lang.Object
-
- ptolemy.actor.gt.GTIngredient
-
- ptolemy.actor.gt.ingredients.criteria.Criterion
-
- ptolemy.actor.gt.ingredients.criteria.StateTypeCriterion
-
public class StateTypeCriterion extends Criterion
A criterion to constrain the type of a state in an FSM or Ptera controller.- 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.GTIngredient
FIELD_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description StateTypeCriterion(GTIngredientList owner)
Construct a criterion within the given list as its owner.StateTypeCriterion(GTIngredientList owner, boolean isInit, boolean isFinal)
Construct a criterion within the given list as its owner and with the given value to each of its elements..StateTypeCriterion(GTIngredientList owner, java.lang.String values)
Construct a criterion 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
isApplicable(NamedObj object)
Check whether this GTIngredient is applicable to the object.boolean
isFinal()
Get the isFinal element.boolean
isFinalEnabled()
Return whether the isFinal element is enabled.boolean
isInit()
Get the isInit element.boolean
isInitEnabled()
Return whether the isInit element is enabled.boolean
match(NamedObj object)
Test whether the given object in the host model matches the object in the pattern that has this criterion.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, isEnabled, setEnabled, toString
-
-
-
-
Constructor Detail
-
StateTypeCriterion
public StateTypeCriterion(GTIngredientList owner)
Construct a criterion 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.
-
StateTypeCriterion
public StateTypeCriterion(GTIngredientList owner, java.lang.String values)
Construct a criterion 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.
-
StateTypeCriterion
public StateTypeCriterion(GTIngredientList owner, boolean isInit, boolean isFinal)
Construct a criterion 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.isInit
- Value of the isInit element.isFinal
- Value of the isFinal element.
-
-
Method Detail
-
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)
-
isApplicable
public boolean isApplicable(NamedObj object)
Check whether this GTIngredient is applicable to the object.- Overrides:
isApplicable
in classGTIngredient
- Parameters:
object
- The object.- Returns:
- true if this GTIngredient is applicable; false otherwise.
-
isFinal
public boolean isFinal()
Get the isFinal element.- Returns:
- The isFinal element.
-
isFinalEnabled
public boolean isFinalEnabled()
Return whether the isFinal element is enabled.- Returns:
- true if the isFinal element is enabled.
-
isInit
public boolean isInit()
Get the isInit element.- Returns:
- The isInit element.
-
isInitEnabled
public boolean isInitEnabled()
Return whether the isInit element is enabled.- Returns:
- true if the isInit element is enabled.
-
match
public boolean match(NamedObj object)
Test whether the given object in the host model matches the object in the pattern that has this criterion.
-
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.
-
-