net.sf.myra.antree
Class TreeComparator

java.lang.Object
  extended by net.sf.myra.antree.TreeComparator
All Implemented Interfaces:
java.util.Comparator<Tree>

public class TreeComparator
extends java.lang.Object
implements java.util.Comparator<Tree>

Version:
$Revision: 2320 $ $Date:: 2011-01-25 13:06:10#$
Author:
Fernando Esteban Barril Otero

Constructor Summary
TreeComparator()
           
 
Method Summary
 int compare(Tree t1, Tree t2)
          Compares the two specified tree.
 
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

TreeComparator

public TreeComparator()
Method Detail

compare

public int compare(Tree t1,
                   Tree t2)
Compares the two specified tree. The comparison takes into account the quality and the size of the trees. A tree is considered 'bigger' if it has a higher quality value or the same quality value but it is smaller in size.

Specified by:
compare in interface java.util.Comparator<Tree>
Parameters:
t1 - the first tree to be compared.
t2 - the second tree to be compared.
Returns:
-1 if the first tree is 'smaller' that the second; 0 if the tree are 'equal' (same quality and size); 1 if the first tree is 'bigger' than the second tree.


Copyright © 2013. All Rights Reserved.