|
HTML Parser Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Ordered
Describes an object that knows about ordering. Implementors must have a comparison function, which imposes a partial ordering on some collection of objects. Ordered objects can be passed to a sort method (such as org.htmlparser.util.sort.Sort) to allow precise control over the sort order.
An set of elements S is partially ordered
if and only if e1.compare(e2)==0
implies that
e1.equals(e2)
for every e1 and e2 in S.
This all goes away in JDK 1.2.
For use with java.lang.Comparable from JDK 1.2:
public int compare (Object o1, Object o2) { return (((Ordered)o1).compare (o2)); }
Sort
Method Summary | |
---|---|
int |
compare(Object that)
Compares this object with another for order. |
Method Detail |
---|
int compare(Object that)
The implementor must ensure that
sgn(x.compare(y)) == -sgn(y.compare(x))
for all x and y. (This implies that x.compare(y)
must throw an exception if and only if y.compare(x)
throws an exception.)
The implementor must also ensure that the relation is transitive:
((x.compare(y)>0) && (y.compare(z)>0))
implies x.compare(z)>0
.
Finally, the implementer must ensure that
x.compare(y)==0
implies that
sgn(x.compare(z))==sgn(y.compare(z))
for all z.
that
- The object to compare this object against.
ClassCastException
- The arguments type prevents it
from being compared by this Ordered.
|
© 2006 Derrick Oswald Sep 17, 2006
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
HTML Parser is an open source library released under Common Public License. |