All Packages Class Hierarchy This Package Previous Next Index
Interface edu.vt.marian.common.Sortable
- public interface Sortable
A quicksort object which can be used to sort the elements of
an enumeration in either non-increasing or non-decreasing order.
The only requirement is that each element of the object being
sorted implements the Sortable interface. Basically, this means
an object provides a compare() method which can be used to
determine whether one object is less than, equal to, or greater
than another object.
-
DECREASING
- Indicate that we want to sort in non-increasig order
-
EQUAL
- Magic number to indicate object being compared against us is
equal to our value
-
GREATER
- Magic number to indicate object being compared against us is
greater than our value
-
INCOMPARABLE
- Magic number to indicate object being compared against us is
incomparable to us.
-
INCREASING
- Indicate that we want to sort in non-decreasing order
-
LESS
- Magic number to indicate object being compared against us is
less than our value
-
compare(Object)
- Compare an object with ourselves and return an int indicating
how it compares relative to us.
INCREASING
public static final int INCREASING
- Indicate that we want to sort in non-decreasing order
DECREASING
public static final int DECREASING
- Indicate that we want to sort in non-increasig order
LESS
public static final int LESS
- Magic number to indicate object being compared against us is
less than our value
EQUAL
public static final int EQUAL
- Magic number to indicate object being compared against us is
equal to our value
GREATER
public static final int GREATER
- Magic number to indicate object being compared against us is
greater than our value
INCOMPARABLE
public static final int INCOMPARABLE
- Magic number to indicate object being compared against us is
incomparable to us.
compare
public abstract int compare(Object obj)
- Compare an object with ourselves and return an int indicating
how it compares relative to us. The int is returned as follows:
- Sortable.LESS if our value is less than that of the object
to which we are being compared;
- Sortable.EQUAL if our value is equal to that of the object
to which we are being compared;
- Sortable.GREATER if our value is greater than that of the object
to which we are being compared;
- Sortable.INCOMPARABLE if our value cannot be validly compared
against the object given (e.g., it is of a different type, with
no meaningful comparison semantics relative to us)
- Parameters:
- obj - the object to which we are being compared
- Returns:
- an integer denoting how we compare to the obj supplied
All Packages Class Hierarchy This Package Previous Next Index