org.acm.seguin.pretty.sort
Class Ordering

java.lang.Object
  extended by org.acm.seguin.pretty.sort.Ordering
All Implemented Interfaces:
java.util.Comparator
Direct Known Subclasses:
FieldInitializerOrder, FixupFinalStaticOrder, ProtectionOrder, SameOrdering, SetterGetterOrder, StaticOrder, TopLevelOrdering, TypeOrder

public abstract class Ordering
extends java.lang.Object
implements java.util.Comparator

The ordering is the basic tool to determine if the parse tree node is in the proper order. This object contains the base class for the order.

Author:
Mike Atkinson

Constructor Summary
Ordering()
           
 
Method Summary
 int compare(java.lang.Object one, java.lang.Object two)
          Compare two items
protected abstract  int getIndex(java.lang.Object object)
          Return the index of the item in the order array
 
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
 

Constructor Detail

Ordering

public Ordering()
Method Detail

compare

public int compare(java.lang.Object one,
                   java.lang.Object two)
Compare two items

Specified by:
compare in interface java.util.Comparator
Parameters:
one - the first item
two - the second item
Returns:
1 if the first item is greater than the second, -1 if the first item is less than the second, and 0 otherwise.

getIndex

protected abstract int getIndex(java.lang.Object object)
Return the index of the item in the order array

Parameters:
object - the object we are checking
Returns:
the objects index if it is found or 7 if it is not