|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sri.emo.dbobj.selectiontree.TreeDeletionSelector
public class TreeDeletionSelector
Helps with the the selection of nodes in an association tree. Depends on all nodes having attributes set that indicate their immediate chilren, from TreeSlectionFactory. The general algorithm for selecting necessary nodes is this:
Get a list of all nodes that belong in the tree via strong relations
Trim the bulk of the tree by finding any nodes that are the destinations via any strong relations of nodes outside the tree.
The algorithm for this step is:
for each node N in allNodesInTree if N is destination of strong relation not in allNodesTree save N (Mark as do not delete) end if end for
The situation here arises when External Link -> Node B -> Node A Node A won't register any external links, and will be marked for deletion when it shouldn't be. We use the following algorithm to trim transitive associations, where "ROOT DOWN ORDER" means from the root of the tree to the leaves:
for each node N IN ROOT DOWN ORDER if N is saved, and is parent of node to be deleted move child nodes from "To Delete" collection to "Save" collection recurse down from each child end if end for.
Constructor Summary | |
---|---|
TreeDeletionSelector(Map allNodes)
Build the selector with all nodes in the tree to delete. |
Method Summary | |
---|---|
void |
determineDeletionTree(Node rootToDelete,
Collection toSave,
Collection toDelete)
After step 1 is completed (see class-level javadoc), this function performs the remaining deletion steps. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TreeDeletionSelector(Map allNodes)
allNodes
- MapMethod Detail |
---|
public void determineDeletionTree(Node rootToDelete, Collection toSave, Collection toDelete) throws DBException
rootToDelete
- The root of the tree to delete. It is best
to use a collection that can have speedy iteration and deletions.toSave
- A collection to be built of objects to save. It is
better to use a collection that can have speedy lookups and insertions.toDelete
- A collection to be built of objects to delete.
DBException
- upon Expresso database error.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |