Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.clra.rowing
Class DefaultRowingSessionTypeComparator  view DefaultRowingSessionTypeComparator download DefaultRowingSessionTypeComparator.java

java.lang.Object
  extended bycom.clra.rowing.DefaultRowingSessionTypeComparator
All Implemented Interfaces:
java.util.Comparator, java.io.Serializable

public class DefaultRowingSessionTypeComparator
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

Compares RowingSessionLevel instances as well as Strings. The default order is PRACTICE, REGATTA.

Version:
$Revision: 1.3 $ $Date: 2003/02/26 03:38:45 $

Field Summary
private static java.lang.String base
           
private static java.util.Map ordinalMap
           
private static org.apache.log4j.Category theLog
           
 
Constructor Summary
DefaultRowingSessionTypeComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Return an integer that is negative, zero or positive depending on whether the first argument is less than, equal to or greater than the second according to this ordering.
private static java.lang.Integer getOrdinal(java.lang.Object o)
           
private static java.lang.Integer getOrdinal(RowingSessionType rst)
           
private static java.lang.Integer getOrdinal(java.lang.String s)
           
private static java.lang.String makeKey(RowingSessionType rst)
           
private static java.lang.String makeKey(java.lang.String s)
           
static int staticCompare(java.lang.Object o1, java.lang.Object o2)
          Compares a level to other levels and valid level names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

base

private static final java.lang.String base

theLog

private static final org.apache.log4j.Category theLog

ordinalMap

private static final java.util.Map ordinalMap
Constructor Detail

DefaultRowingSessionTypeComparator

public DefaultRowingSessionTypeComparator()
Method Detail

makeKey

private static final java.lang.String makeKey(java.lang.String s)

makeKey

private static final java.lang.String makeKey(RowingSessionType rst)

getOrdinal

private static final java.lang.Integer getOrdinal(java.lang.String s)

getOrdinal

private static final java.lang.Integer getOrdinal(RowingSessionType rst)

getOrdinal

private static final java.lang.Integer getOrdinal(java.lang.Object o)

staticCompare

public static int staticCompare(java.lang.Object o1,
                                java.lang.Object o2)
Compares a level to other levels and valid level names. The default order is LTR then REGULAR.


compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Description copied from interface: java.util.Comparator
Return an integer that is negative, zero or positive depending on whether the first argument is less than, equal to or greater than the second according to this ordering. This method should obey the following contract:
  • if compare(a, b) < 0 then compare(b, a) > 0
  • if compare(a, b) throws an exception, so does compare(b, a)
  • if compare(a, b) < 0 and compare(b, c) < 0 then compare(a, c) < 0
  • if compare(a, b) == 0 then compare(a, c) and compare(b, c) must have the same sign
To be consistent with equals, the following additional constraint is in place:
  • if a.equals(b) or both a and b are null, then compare(a, b) == 0.

Although it is permissible for a comparator to provide an order inconsistent with equals, that should be documented.

Specified by:
compare in interface java.util.Comparator