org.eclipse.actf.model.traverse
Class AbstractTreeNodeWalker

java.lang.Object
  extended by org.eclipse.actf.model.traverse.AbstractNodeWalker
      extended by org.eclipse.actf.model.traverse.AbstractTreeNodeWalker
All Implemented Interfaces:
INodeWalker, ITreeNodeWalker
Direct Known Subclasses:
AccessibleElementTreeWalker, ContainerTreeNodeWalker, DomTreeNodeWalker, SwtTreeNodeWalker

public abstract class AbstractTreeNodeWalker
extends AbstractNodeWalker
implements ITreeNodeWalker

base implementation for any tree walker

Author:
Mike Squillace

Field Summary
protected  ClassLoaderCache clCache
           
protected  Map componentBridgeMap
           
protected  IConfiguration configuration
           
 
Fields inherited from class org.eclipse.actf.model.traverse.AbstractNodeWalker
nodeFilters
 
Constructor Summary
AbstractTreeNodeWalker()
           
 
Method Summary
protected  Object getBridgedChild(Object parent)
           
protected  Object getBridgedParent(Object child)
           
 Object[] getFilteredChildren(Object parent)
          returns the children of the given node that pass all filteres that were added using the addNodeFilter method.
 Object[] getFilteredSuccessorNodes(Object node)
          retreave the direct successors of the given element that pass each of the node filters added via the addNodeFilter method.
 Object[] getPredecessorNodes(Object node)
          retreave the direct predecessors of the given element.
 Object[] getSuccessorNodes(Object node)
          retreave the direct successors of the given element.
 boolean hasChildren(Object element)
          returns whether or not the given node has any children.
 void setComponentBridgeMap(Map bridgeMap)
          map for associating nodes of heterogeneous types.
 
Methods inherited from class org.eclipse.actf.model.traverse.AbstractNodeWalker
addNodeFilter, removeAllFilters, removeNodeFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.actf.model.traverse.ITreeNodeWalker
getChildren, getParent
 
Methods inherited from interface org.eclipse.actf.model.traverse.INodeWalker
addNodeFilter, getStartNodes, removeAllFilters, removeNodeFilter
 

Field Detail

clCache

protected ClassLoaderCache clCache

configuration

protected IConfiguration configuration

componentBridgeMap

protected Map componentBridgeMap
Constructor Detail

AbstractTreeNodeWalker

public AbstractTreeNodeWalker()
Method Detail

setComponentBridgeMap

public void setComponentBridgeMap(Map bridgeMap)
map for associating nodes of heterogeneous types. The map should contain keys that are parents and each parent key should be associated with a child to which the walker can traverse once it encounters the parent. Bridge maps are useful for traversing nodes of vastly different types linked via unconventional mechanisms.

Specified by:
setComponentBridgeMap in interface ITreeNodeWalker

getBridgedChild

protected Object getBridgedChild(Object parent)

getBridgedParent

protected Object getBridgedParent(Object child)

hasChildren

public boolean hasChildren(Object element)
                    throws InvalidComponentException
returns whether or not the given node has any children.

Specified by:
hasChildren in interface ITreeNodeWalker
Parameters:
element - - node of tree
Returns:
true if node has children, false otherwise
Throws:
InvalidComponentException - if component is disposed or otherwise invalid

getSuccessorNodes

public Object[] getSuccessorNodes(Object node)
                           throws InvalidComponentException
retreave the direct successors of the given element. The direct successors of the given element are those elements that are connected to the given element via a single edge and serve as tails on that edge, permitting the given element to serve as the head.

Specified by:
getSuccessorNodes in interface INodeWalker
Parameters:
node - - node for which direct successors are desired
Returns:
direct successors of given node or empty array if no successors are present
Throws:
InvalidComponentException

getFilteredSuccessorNodes

public Object[] getFilteredSuccessorNodes(Object node)
                                   throws InvalidComponentException
retreave the direct successors of the given element that pass each of the node filters added via the addNodeFilter method. The direct successors of the given element are those elements that are connected to the given element via a single edge and serve as tails on that edge, permitting the given element to serve as the head.

If no filters have been added or if all filters pass all successor nodes, then this method is equivalent to getSuccessorNodes.

Specified by:
getFilteredSuccessorNodes in interface INodeWalker
Parameters:
node - - node for which direct successors are desired
Returns:
direct successors of given node (filtered) or empty array if no successors are present
Throws:
InvalidComponentException
See Also:
INodeWalker.addNodeFilter(INodeFilter)

getFilteredChildren

public Object[] getFilteredChildren(Object parent)
                             throws InvalidComponentException
returns the children of the given node that pass all filteres that were added using the addNodeFilter method.

Specified by:
getFilteredChildren in interface ITreeNodeWalker
Parameters:
parent - - node of tree
Returns:
filtered children of given node or empty array if no children are found
Throws:
InvalidComponentException - if component is disposed or otherwise invalid
See Also:
INodeWalker.getFilteredSuccessorNodes(Object), INodeWalker.addNodeFilter(INodeFilter)

getPredecessorNodes

public Object[] getPredecessorNodes(Object node)
                             throws InvalidComponentException
retreave the direct predecessors of the given element. The direct predecessors of the given element are those elements that are connected to the given element via a single edge and serve as heads on that edge, permitting the given element to serve as the tail.

Specified by:
getPredecessorNodes in interface INodeWalker
Parameters:
node - - node for which direct predecessors are desired
Returns:
direct predecessors of given node or empty array if no predecessors are present
Throws:
InvalidComponentException