public class Comparison extends Predicate
expressions, maxOperands
factory, type
Constructor and Description |
---|
Comparison()
Creates a default Comparison.
|
Comparison(java.lang.String name)
Creates a Comparison with the given name.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Boolean |
equals(java.lang.Object first,
java.lang.Object second)
Reports whether two values are equal.
|
java.lang.Boolean |
evaluate()
Executes this Comparison predicate on its operands.
|
boolean |
isConsistent()
Reports whether this Comparison is consistent.
|
protected java.lang.Boolean |
lessThan(java.lang.Object first,
java.lang.Object second)
Reports whether the first value is less than the second value.
|
protected java.lang.Boolean |
moreThan(java.lang.Object first,
java.lang.Object second)
Reports whether the first value is greater than the second value.
|
protected void |
nameCheck()
Checks the name of a Comparison predicate and sets the expected
number of operands.
|
Predicate |
negate()
Returns the complement of this Comparison.
|
protected java.lang.Boolean |
notEquals(java.lang.Object first,
java.lang.Object second)
Reports whether two values are not equal.
|
protected java.lang.Boolean |
notLessThan(java.lang.Object first,
java.lang.Object second)
Reports whether the first value is greater than, or equal to the second
value.
|
protected java.lang.Boolean |
notMoreThan(java.lang.Object first,
java.lang.Object second)
Reports whether the first value is less than, or equal to the second
value.
|
protected void |
rebindFalse()
Rebinds the unbound operands of this Comparison, so that it yields
false.
|
protected void |
rebindTrue()
Rebinds the unbound operands of this Comparison, so that it yields
true.
|
java.util.List<Predicate> |
refine()
Returns a list of refinements of this Comparison.
|
Predicate |
reverse()
Returns the symmetric reversal of this Comparison.
|
boolean |
subsumes(Predicate other)
Tests whether this Comparison subsumes the other Predicate.
|
protected boolean |
subsumesComparison(Predicate other)
Tests whether this comparison subsumes the other comparison.
|
protected void |
typeCheck()
Checks that the operand types are consistent, and the result type is
Boolean.
|
isFalseConstant, normalise, rebind, rebind, setType, subsumesAllDisjunctsOf, subsumesOneConjunctOf, subsumesProposition
addExpression, assign, equals, getExpressions, getType, hashCode, isAssignable, isBound, operand, resolve, setName, toString, unbind
getName, isBottom, isOrdered
safeEquals, safeHashCode, semanticError
public Comparison()
public Comparison(java.lang.String name)
name
- the name of this Comparison.protected void nameCheck()
protected void typeCheck()
public boolean subsumes(Predicate other)
protected boolean subsumesComparison(Predicate other)
other
- the other comparison.public boolean isConsistent()
isConsistent
in class Predicate
public Predicate negate()
public Predicate reverse()
public java.util.List<Predicate> refine()
public java.lang.Boolean evaluate() throws SemanticError
evaluate
in class Predicate
SemanticError
protected java.lang.Boolean equals(java.lang.Object first, java.lang.Object second)
first
- the first value.second
- the second value.protected java.lang.Boolean notEquals(java.lang.Object first, java.lang.Object second)
first
- the first value.second
- the second value.protected java.lang.Boolean lessThan(java.lang.Object first, java.lang.Object second)
first
- the first value.second
- the second value.protected java.lang.Boolean moreThan(java.lang.Object first, java.lang.Object second)
first
- the first value.second
- the second value.protected java.lang.Boolean notLessThan(java.lang.Object first, java.lang.Object second)
first
- the first value.second
- the second value.protected java.lang.Boolean notMoreThan(java.lang.Object first, java.lang.Object second)
first
- the first value.second
- the second value.protected void rebindTrue()
rebindTrue
in class Predicate
protected void rebindFalse()
rebindFalse
in class Predicate