org.acm.seguin.pretty.sort
Class SetterGetterOrder

java.lang.Object
  extended by org.acm.seguin.pretty.sort.Ordering
      extended by org.acm.seguin.pretty.sort.SetterGetterOrder
All Implemented Interfaces:
java.util.Comparator

public class SetterGetterOrder
extends Ordering

Orders the items in a class according to type.

Author:
Chris Seguin, Mike Atkinson

Constructor Summary
SetterGetterOrder(java.lang.String ordering)
          Constructor for the SetterGetterOrder object
 
Method Summary
protected  int getIndex(java.lang.Object object)
          Return the index of the item in the order array
 
Methods inherited from class org.acm.seguin.pretty.sort.Ordering
compare
 
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

SetterGetterOrder

public SetterGetterOrder(java.lang.String ordering)
Constructor for the SetterGetterOrder object

The string should either be "instance", "static", or "class". "instance" means that instance variables should go first. Either of the other two ordering strings indicate that the class variables or methods should go first.

Parameters:
ordering - A user specified string that describes the order.
Method Detail

getIndex

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

Specified by:
getIndex in class Ordering
Parameters:
object - the object we are checking
Returns:
the objects index if it is found or 7 if it is not