public final class RelationNode
extends java.lang.Object
RelationType
.
For more details of difference, see
ParseTreeEvaluatorForGuardExpression
.
The instance stores the information of two evaluations of the transition,
the current evaluation and the previous evaluation.Constructor and Description |
---|
RelationNode(int type,
double difference)
Construct a relation node with given type and difference
information.
|
Modifier and Type | Method and Description |
---|---|
void |
commit()
Update the previous type and difference information of this relation
node with the current evaluation result.
|
double |
getDifference()
Return the difference information from the current evaluation of the
relation node.
|
double |
getPreviousDifference()
Return the difference information from the previous evaluation of the
relation node.
|
boolean |
hasEvent()
Return true if the relation node has its type changed, and if the
current type is equal/inequal or the current type changes from
less_than to bigger_than or bigger_than to less_than.
|
void |
reset()
Reset the relation node by setting the former type and difference
information to RelationType.INVALID and 0.0 respectively.
|
void |
setDifference(double difference)
Set the difference information with the current evaluation result
of the relation node.
|
void |
setType(int type)
Set the type information with the current evaluation result of the
relation node.
|
boolean |
typeChanged()
Return true if the type changed and the previous type
information is valid.
|
public RelationNode(int type, double difference)
type
- The type, one of RelationType
.difference
- The difference.public void reset()
public void commit()
public double getDifference()
setDifference(double)
public double getPreviousDifference()
public boolean hasEvent()
public void setType(int type)
type
- The current type information.public void setDifference(double difference)
difference
- The current difference information.getDifference()
public boolean typeChanged()