Package de.unirostock.sems.xmlutils.ds
Class TreeNodeComparatorBySubtreeSize
- java.lang.Object
-
- de.unirostock.sems.xmlutils.ds.TreeNodeComparatorBySubtreeSize
-
- All Implemented Interfaces:
Comparator<TreeNode>
public class TreeNodeComparatorBySubtreeSize extends Object implements Comparator<TreeNode>
The Class TreeNodeComparatorBySubtreeSize to compare sub-trees below nodes by size.- Author:
- Martin Scharm
-
-
Constructor Summary
Constructors Constructor Description TreeNodeComparatorBySubtreeSize()Instantiates a new comparator sorting subtrees ascending.TreeNodeComparatorBySubtreeSize(boolean reverse)Instantiates a new comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(TreeNode o1, TreeNode o2)-
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, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
TreeNodeComparatorBySubtreeSize
public TreeNodeComparatorBySubtreeSize()
Instantiates a new comparator sorting subtrees ascending.
-
TreeNodeComparatorBySubtreeSize
public TreeNodeComparatorBySubtreeSize(boolean reverse)
Instantiates a new comparator. If reverse istruesubtrees are sorted in descending order, otherwise ascending.- Parameters:
reverse- the reverse
-
-
Method Detail
-
compare
public int compare(TreeNode o1, TreeNode o2)
- Specified by:
comparein interfaceComparator<TreeNode>
-
-