public class RelationList
extends java.lang.Object
ParseTreeEvaluatorForGuardExpression
for the detailed explanation
of relation type and difference.) This attribute is non-persistent and will
not be exported into MoML.
This class is designed to be used with ParseTreeEvaluatorForGuardExpression. The common usage would be like:
Construct a relation list for a transition with the first argument of the constructor as that transition.
_relationList = new RelationList();
Associate the relation list with the an object of ParseTreeEvaluatorForGuardExpression
_parseTreeEvaluator = new ParseTreeEvaluatorForGuardExpression(_relationList, getErrorTolerance());
See Transition
for the detailed usage.
Constructor and Description |
---|
RelationList()
Construct a relation list.
|
Modifier and Type | Method and Description |
---|---|
void |
addRelation(int type,
double difference)
Construct a relation node with the given type and difference
information of a relation, and add it to the end of the relation
list.
|
void |
commitRelationValues()
Record the current relation values so that when getPreviousMaximumDistance()
is called, these recorded values are used.
|
void |
destroy()
Destroy the relation list by deleting all the contained elements.
|
double |
getMaximumDifference()
Return the maximum current difference of all the relations by iterating
the relation list.
|
double |
getPreviousMaximumDistance()
Return the previous difference of the relation that has the
maximum current difference.
|
boolean |
hasEvent()
Return true if there exists an event caused by the type change of
any relation.
|
boolean |
isEmpty()
Return true if the relation list is empty.
|
int |
length()
Return the number of relations in the relation list.
|
void |
resetRelationList()
Reset the relation list by resetting each relation node.
|
void |
setRelation(int relationIndex,
int type,
double difference)
Update the relation in the relation list referred by the
relation index argument with the given type and difference
information.
|
public void addRelation(int type, double difference)
type
- The relation type of the relation.difference
- The difference of the relation.public void resetRelationList()
public void commitRelationValues()
getPreviousMaximumDistance()
public void destroy()
public double getPreviousMaximumDistance()
commitRelationValues()
public boolean hasEvent()
public boolean isEmpty()
public int length()
public double getMaximumDifference()
public void setRelation(int relationIndex, int type, double difference)
relationIndex
- The position of the relation in the
relation list.type
- The current type of the relation.difference
- The current difference of the relation.