public class Inequality
extends java.lang.Object
InequalityTerms
, the lesser
term and the greater term. The relation between them is less than or
equal to. In addition, an inequality keeps a list of variables in it.
The variables are InequalityTerms
that consist of a single
variable.InequalityTerm
Green (kienhuis) |
Green (yuhong) |
Constructor and Description |
---|
Inequality(InequalityTerm lesserTerm,
InequalityTerm greaterTerm)
Construct an inequality.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object)
Return true if object named by the argument is equal to
this Inequality object.
|
InequalityTerm |
getGreaterTerm()
Return the greater term of this inequality.
|
InequalityTerm |
getLesserTerm()
Return the lesser term of this inequality.
|
int |
hashCode()
Return the hashCode of this object.
|
boolean |
isSatisfied(CPO cpo)
Test if this inequality is satisfied with the current value
of variables.
|
java.lang.String |
toString()
Override the base class to describe the inequality.
|
public Inequality(InequalityTerm lesserTerm, InequalityTerm greaterTerm)
lesserTerm
- An InequalityTerm
that is less than or
equal to the second argument.greaterTerm
- An InequalityTerm
that is greater than
or equal to the first argument.java.lang.IllegalArgumentException
- If the lesserTerm
or
the greaterTerm
is null
.public boolean equals(java.lang.Object object)
Override to return true if the greater and lesser terms of this object are the same as the greater and lesser terms of the specified object.
equals
in class java.lang.Object
object
- Object to compare against.public InequalityTerm getGreaterTerm()
InequalityTerm
public InequalityTerm getLesserTerm()
InequalityTerm
public int hashCode()
Override to return the exclusive OR of the hashcodes of the greater and lesser terms. This ensures that two objects that return true to equals() have the same hashcode.
hashCode
in class java.lang.Object
public boolean isSatisfied(CPO cpo) throws IllegalActionException
cpo
- A CPO over which this inequality is defined.IllegalActionException
- If thrown while getting
the value of the terms.public java.lang.String toString()
toString
in class java.lang.Object