add sortChildren
[jSite2.git] / src / net / pterodactylus / util / data / Node.java
index 560fc34..950ed99 100644 (file)
@@ -1,6 +1,7 @@
 
 package net.pterodactylus.util.data;
 
+import java.util.Comparator;
 import java.util.Iterator;
 
 /**
@@ -12,7 +13,7 @@ import java.util.Iterator;
  * @param <E>
  *            The type of the element to store
  */
-public interface Node<E> extends Iterable<Node<E>> {
+public interface Node<E extends Comparable<E>> extends Iterable<Node<E>>, Comparable<Node<E>> {
 
        /**
         * Returns the parent node of the node.
@@ -152,4 +153,17 @@ public interface Node<E> extends Iterable<Node<E>> {
         */
        public Node<E> findChild(E element);
 
+       /**
+        * Sorts all children according to their natural order.
+        */
+       public void sortChildren();
+
+       /**
+        * Sorts all children with the given comparator.
+        * 
+        * @param comparator
+        *            The comparator used to sort the children
+        */
+       public void sortChildren(Comparator<Node<E>> comparator);
+
 }
\ No newline at end of file