com.objex.panywhere
Class PedigreeComparator

java.lang.Object
  extended by com.objex.panywhere.PedigreeComparator
All Implemented Interfaces:
java.util.Comparator

public class PedigreeComparator
extends java.lang.Object
implements java.util.Comparator

Forces the comparison of and hence ordering of Individuals to be based on Integer values of UPN's and hence effect the ordering based on that or on TreeID depending on the paremeter pased to the Constructor. A bug has been identified on the this comparator which failed when the order was "TREEID" in ascending order. The comparator here had been inadequately implemented and was returning one Individual per treeID. That bug has been fixed and the comparator now compares properly based on the TREE first and then the UPN where the tree ID is uniform. This guarantees that the returned list is the same (number of objects) as the input list when it comes to sorted maps and sorted sets and treemaps.


Constructor Summary
PedigreeComparator(int ai_order, Family aFamily)
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Callback function that helps in the creation of an ordered list of Individuals based on the list that is being compared.
 
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

PedigreeComparator

public PedigreeComparator(int ai_order,
                          Family aFamily)
Parameters:
ai_order - The order in which the individuals list will be done.
aFamily - The family of which the Individuals to be ordered are part. 1 - Order by UPN. Object 1 and Object 2 are UPN's 2 - Order by TreeID. Object 1 and Object 2 are Individual objects from which the treeID will be retrieved. 3 - Order by X-cordinate with the leftmost coming first. Used in ordering individuals within a generation
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Callback function that helps in the creation of an ordered list of Individuals based on the list that is being compared. If the list passed consists of a list of UPNs then the order is 1 - Order by UPN. Object 1 and Object 2 are UPN's 2 - Order by TreeID. Object 1 and Object 2 are Individual objects from which the treeID will be retrieved.

Specified by:
compare in interface java.util.Comparator