com.sri.emo.dbobj.selectiontree
Class TreeSelectionFactory

java.lang.Object
  extended by com.sri.emo.dbobj.selectiontree.TreeSelectionFactory

public class TreeSelectionFactory
extends Object

Selects a tree of associated nodes. Each node from the root is included in the tree if it has a strong relationship with its parent.

each parent has an attribute MyChildren set with an Node[] array of children, and each child has an attribute set for its parent, a Node.

Example Code

 Node n = new Node();
 //Set values
 

TreeSelectionFactory selectionFactory = new TreeSelectionFactory(n); Map allNodesElegibleForDeletion = selectionFactory.getNodesInTree();

Author:
Michael Rimov, Larry Hamel
To Do:
Rewrite the model as a series of decorative interfaces that have an in-memory tree design -- use that tree design to assign indentation levels.

Field Summary
static String IS_PARENT_OF
           
 
Constructor Summary
TreeSelectionFactory(Node root)
          Construct a TreeSelectionFactory given the root ndoe.
 
Method Summary
 Map getNodesInStronglyRelatedTree()
          Get ALL related nodes in tree beneath this node EXCEPT types indicated for omission recurses into tree; side-effect: adds attribute 'level' with node level w/i tree to each node.
static void getNodesInStronglyRelatedTreeRecursive(Node currentNode, Map outputMap)
          Handles the recursive traversal through related nodes in a tree.
 Map getNodesInTree()
          Get ALL related nodes in tree beneath this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_PARENT_OF

public static final String IS_PARENT_OF
See Also:
Constant Field Values
Constructor Detail

TreeSelectionFactory

public TreeSelectionFactory(Node root)
Construct a TreeSelectionFactory given the root ndoe.

Parameters:
root - Node
Method Detail

getNodesInTree

public Map getNodesInTree()
                   throws DBException
Get ALL related nodes in tree beneath this node.

side-effect: adds attribute 'level' with node level w/i tree to each node. side-effect: adds attribute 'MyParentIs' with parent node side-effect: adds attribute 'MyChildren' with array of Nodes of all children

uses optional INDENT attribute to determine formatting indentation

Returns:
Map keyed by node id, pointing to the nodes in the tree.
Throws:
DBException
To Do:
get rid of side affect.

getNodesInStronglyRelatedTree

public Map getNodesInStronglyRelatedTree()
                                  throws DBException
Get ALL related nodes in tree beneath this node EXCEPT types indicated for omission recurses into tree; side-effect: adds attribute 'level' with node level w/i tree to each node.

uses optional INDENT attribute to determine formatting indentation

Throws:
DBException - upon database access error.

getNodesInStronglyRelatedTreeRecursive

public static void getNodesInStronglyRelatedTreeRecursive(Node currentNode,
                                                          Map outputMap)
                                                   throws DBException
Handles the recursive traversal through related nodes in a tree. Adds side-effect of an attribute on each node that is array of all immediate children. (null if none)

Parameters:
outputMap - Map
Throws:
DBException


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.