Expresso 5-6

com.jcorporate.expresso.core.dbobj
Class ValidValue.DescriptionComparator

java.lang.Object
  extended bycom.jcorporate.expresso.core.dbobj.ValidValue.DescriptionComparator
All Implemented Interfaces:
Comparator
Enclosing class:
ValidValue

public static class ValidValue.DescriptionComparator
extends Object
implements Comparator

A simple comparator for comparing the description attribute of ValidValue records.


Constructor Summary
ValidValue.DescriptionComparator()
          Creates an ascending comparator
ValidValue.DescriptionComparator(boolean reverse)
          Creates comparator with specified direction
 
Method Summary
 int compare(Object o1, Object o2)
          Comparison method Compares its two arguments for order.
 boolean equals(Object o)
          Equivalence method
 String toString()
          Human readable string
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidValue.DescriptionComparator

public ValidValue.DescriptionComparator()
Creates an ascending comparator


ValidValue.DescriptionComparator

public ValidValue.DescriptionComparator(boolean reverse)
Creates comparator with specified direction

Parameters:
reverse - true if should use reverse sort order.
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Comparison method Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that sgn(compare(x, y)) == -sgn(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementer must ensure that compare(x, y)==0 implies that sgn(compare(x, z))==sgn(compare(y, z)) for all z.

It is generally the case, but not strictly required that (compare(x, y)==0) == (x.equals(y)). Generally speaking, any comparator that violates this condition should clearly indicate this fact. The recommended language is "Note: this comparator imposes orderings that inconsistent with equals."

Specified by:
compare in interface Comparator
Parameters:
o1 - the first ValidValue object
o2 - the second ValidValue object
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Throws:
ClassCastException - if the arguments' types prevent them from being compared by this Comparator.

equals

public boolean equals(Object o)
Equivalence method

Specified by:
equals in interface Comparator
Parameters:
o - the Other object
Returns:
true if the objects are equal.

toString

public String toString()
Human readable string

Returns:
java.lang.String

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.