|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.util.TreeComparator<N,EX>
N - The node typeEX - The exception that the abstract methods may throwpublic abstract class TreeComparator<N extends TreeComparator.Node<N>,EX extends java.lang.Exception>
Recursively compares two trees of nodes. Non-leaf nodes have a SortedSet of keys to child nodes.
compare(Node, Node)| Nested Class Summary | |
|---|---|
static interface |
TreeComparator.Node<N extends TreeComparator.Node<N>>
The superinterface for leaf nodes and non-leaf nodes. |
| Constructor Summary | |
|---|---|
TreeComparator()
|
|
| Method Summary | |
|---|---|
void |
compare(N node1,
N node2)
If both nodes are non-leaf nodes, nodeDeleted(N) and nodeAdded(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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TreeComparator()
| Method Detail |
|---|
public void compare(N node1,
N node2)
throws EX extends java.lang.Exception
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.
EX extends java.lang.Exception
protected abstract void nodeAdded(N node)
throws EX extends java.lang.Exception
compare(Node, Node) for every node that does not exist under node1, but under node2.
EX extends java.lang.Exception
protected abstract void nodeDeleted(N node)
throws EX extends java.lang.Exception
compare(Node, Node) for every node that exists under node1,
but not under node2.
EX extends java.lang.Exception
protected abstract void nonLeafNodeChangedToLeafNode(N node1,
N node2)
throws EX extends java.lang.Exception
compare(Node, Node) for every node that is a non-leaf node under
node1 and a leaf node under node2.
EX extends java.lang.Exception
protected abstract void leafNodeChangedToNonLeafNode(N node1,
N node2)
throws EX extends java.lang.Exception
compare(Node, Node) for every node that is a leaf node under node1 and a non-leaf node under node2.
EX extends java.lang.Exception
protected abstract void leafNodeRemains(N node1,
N node2)
throws EX extends java.lang.Exception
compare(Node, Node) for every leaf node that exists under node1 and under node2.
EX extends java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||