org.favabeans.util
Interface PoComparable

All Known Implementing Classes:
Type

public interface PoComparable

A PoComparable is an object which can be partially ordered. Given any two PoComparable x, y, the following are the possible cases and the rules under which they apply:

1. Objects are equal

Mathematically, a partial ordering relationship must be antisymmetric, which means that:

x.equals(y) implies (x.lessThan(y) and x.greaterThan(y))

To simplify implementations, however, the contract of a PoComparable is weakened to state that:

x.equals(y) implies (x.lessThan(y) and x.greaterThan(y) are undefined)

2. Objects are unequal but can be compared

If !x.equals(y) then either x.lessThan(y) or x.greaterThan(y) may be true, but not both.

3. Objects are unrelated

If !x.equals(y), a third case is possible where neither x.lessThan(y) nor x.greaterThan(y) is true; this means that x and y are unrelated. This distinguishes a partial ordering from a total ordering.

See Also:
Comparable

Method Summary
 boolean equals(Object x)
          Determine if an object is equal to this one.
 boolean greaterThan(Object x)
          Determine if this object is greater than another one.
 boolean lessThan(Object x)
          Determine if this object is less than another one.
 

Method Detail

greaterThan

public boolean greaterThan(Object x)
Determine if this object is greater than another one.
Parameters:
x - the object to which this object will be compared.
Returns:
true if this object is greater than x; false otherwise.

lessThan

public boolean lessThan(Object x)
Determine if this object is less than another one.
Parameters:
x - the object to which this object will be compared.
Returns:
true if this object is less than x; false otherwise.

equals

public boolean equals(Object x)
Determine if an object is equal to this one.
Overrides:
equals in class Object
Parameters:
x - the object to which this object will be compared.
Returns:
true if this object is equal to x; false otherwise.


Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.