net.sf.farrago.ddl.gen
Class DdlGenerator.MyComparator

java.lang.Object
  extended by net.sf.farrago.ddl.gen.DdlGenerator.MyComparator
All Implemented Interfaces:
Comparator<RefBaseObject>
Enclosing class:
DdlGenerator

private static class DdlGenerator.MyComparator
extends Object
implements Comparator<RefBaseObject>

Comparator for schema elements to ensure that export file occurs in an intuitive order.


Field Summary
private  Class[] classes
           
 
Constructor Summary
private DdlGenerator.MyComparator()
           
 
Method Summary
 int compare(RefBaseObject o1, RefBaseObject o2)
           
private  int compareClass(Object o1, Object o2)
          Compares objects by their class.
private  int compareModelElements(CwmModelElement me1, CwmModelElement me2)
          Compares two model elements of the same type by their position in the hierarchy.
private  int findClass(Object o)
          Returns the ordinal of an object's class in the pecking order, or Integer.MAX_VALUE if not found.
 
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

classes

private final Class[] classes
Constructor Detail

DdlGenerator.MyComparator

private DdlGenerator.MyComparator()
Method Detail

compare

public int compare(RefBaseObject o1,
                   RefBaseObject o2)
Specified by:
compare in interface Comparator<RefBaseObject>

compareClass

private int compareClass(Object o1,
                         Object o2)
Compares objects by their class. An object sorts earlier if its class is higher in the pecking order.


findClass

private int findClass(Object o)
Returns the ordinal of an object's class in the pecking order, or Integer.MAX_VALUE if not found.


compareModelElements

private int compareModelElements(CwmModelElement me1,
                                 CwmModelElement me2)
Compares two model elements of the same type by their position in the hierarchy.