Interface Cmp<T>
- All Superinterfaces:
Comparable<Cmp<T>>
- All Known Implementing Classes:
CmpFactory.CmpMax, CmpFactory.CmpMin, CmpFactory.CmpValue
Interface for abstracting comparison of values.
Only one of the methods
isMin(), isMax(), or hasValue() may return true on any instance.-
Method Summary
Methods inherited from interface Comparable
compareTo
-
Method Details
-
isMin
boolean isMin()Whether this cmp instance is the minimum. compareTo(min, x) returns 0 iff x is min and -1 otherwise -
isMax
boolean isMax()Whether this cmp instance is the maximum. compareTo(max, x) returns 0 iff x is ax and 1 otherwise -
hasValue
boolean hasValue()Whether this cmp instance carries a value. -
getValue
T getValue()Get the value of this cmp. Raises an exception if there is no value.
-