N - The node typeEX - The exception that the abstract methods may throwpublic abstract class TreeComparator<N extends TreeComparator.Node<N>,EX extends Throwable> extends Object
SortedSet of keys to child nodes.compare(Node, Node)| Modifier and Type | Class and Description | 
|---|---|
| static interface  | TreeComparator.Node<N extends TreeComparator.Node<N>>The base interface for leaf nodes and non-leaf nodes. | 
| Constructor and Description | 
|---|
| TreeComparator() | 
| Modifier and Type | Method and Description | 
|---|---|
| long | compare(N node1,
       N node2)If both nodes are non-leaf nodes,  nodeDeleted(N)andnodeAdded(N)are called for each child that
 exists only in the first resp. only in the second child set. | 
| protected abstract void | leafNodeChangedToNonLeafNode(N node1,
                            N node2)This abstract method is invoked by  compare(Node, Node)for every node that is a leaf node under
 node1 and a non-leaf node under node2. | 
| protected abstract void | leafNodeRemains(N node1,
               N node2)This abstract method is invoked by  compare(Node, Node)for every leaf node that exists under
 node1 and under node2. | 
| protected abstract void | nodeAdded(N node)This abstract method is invoked by  compare(Node, Node)for every node that does not exist under
 node1, but under node2. | 
| protected abstract void | nodeDeleted(N node)This abstract method is invoked by  compare(Node, Node)for every node that exists under
 node1, but not under node2. | 
| protected abstract void | nonLeafNodeChangedToLeafNode(N node1,
                            N node2)This abstract method is invoked by  compare(Node, Node)for every node that is a non-leaf node under
 node1 and a leaf node under node2. | 
public long compare(N node1, N node2) throws EX extends Throwable
nodeDeleted(N) and nodeAdded(N) are called for each child that
 exists only in the first resp. only in the second child set. For each child that exists in both child sets, this
 method is invoked recursively.
 
 Otherwise, if one of the nodes is a leaf node and the other is not, leafNodeChangedToNonLeafNode(N, N) or
 nonLeafNodeChangedToLeafNode(N, N) is invoked.
 
 Otherwise, both nodes are leaf nodes, and leafNodeRemains(N, N) is invoked.
protected abstract void nodeAdded(N node) throws EX extends Throwable
compare(Node, Node) for every node that does not exist under
 node1, but under node2.protected abstract void nodeDeleted(N node) throws EX extends Throwable
compare(Node, Node) for every node that exists under
 node1, but not under node2.protected abstract void nonLeafNodeChangedToLeafNode(N node1, N node2) throws EX extends Throwable
compare(Node, Node) for every node that is a non-leaf node under
 node1 and a leaf node under node2.protected abstract void leafNodeChangedToNonLeafNode(N node1, N node2) throws EX extends Throwable
compare(Node, Node) for every node that is a leaf node under
 node1 and a non-leaf node under node2.Copyright © 2018 Arno Unkrig. All rights reserved.