org.planx.xmlstore.nodes
Class NodeNavigator

java.lang.Object
  extended by org.planx.xmlstore.nodes.NodeNavigator
All Implemented Interfaces:
Navigator<SystemNode>
Direct Known Subclasses:
CanonicPolicy

public class NodeNavigator
extends Object
implements Navigator<SystemNode>

Chooses the first node in an equivalence class as the canonical node. Subclass to override policy. If bounds are null no node will be considered outside.


Field Summary
protected  LocalLocator bound1
           
protected  LocalLocator bound2
           
 
Constructor Summary
NodeNavigator()
           
 
Method Summary
 int childCount(SystemNode node)
          Returns the number of children of the specified node.
 SystemNode chooseCanonical(List<Compactor.Edge> eqCls)
          Choose the canonical node from among equivalent nodes.
 SystemNode getChild(SystemNode node, int index)
          Returns the child of the specified node with the specified child index.
 int getHeight(SystemNode node)
          Returns the height of the specified node.
 Object getVisitToken(SystemNode node)
          Returns the visit token of the specified node.
 boolean isOutside(SystemNode node)
          Returns true if the specified node is outside the bounds for the discrimination.
 void setBounds(LocalLocator bound1, LocalLocator bound2)
           
 void setChild(SystemNode node, int index, SystemNode child)
          Replaces an existing reference to a child node.
 void setHeight(SystemNode node, int height)
          Sets the height of the specified node.
 void setVisitToken(SystemNode node, Object token)
          Sets the visit token of the specified node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bound1

protected LocalLocator bound1

bound2

protected LocalLocator bound2
Constructor Detail

NodeNavigator

public NodeNavigator()
Method Detail

setBounds

public void setBounds(LocalLocator bound1,
                      LocalLocator bound2)

isOutside

public boolean isOutside(SystemNode node)
Description copied from interface: Navigator
Returns true if the specified node is outside the bounds for the discrimination. The node will not be visited.

Specified by:
isOutside in interface Navigator<SystemNode>

chooseCanonical

public SystemNode chooseCanonical(List<Compactor.Edge> eqCls)
Description copied from interface: Navigator
Choose the canonical node from among equivalent nodes. This method will only be called for equivalence classes containing more than one element.

Specified by:
chooseCanonical in interface Navigator<SystemNode>

getChild

public SystemNode getChild(SystemNode node,
                           int index)
Description copied from interface: Navigator
Returns the child of the specified node with the specified child index.

Specified by:
getChild in interface Navigator<SystemNode>

setChild

public void setChild(SystemNode node,
                     int index,
                     SystemNode child)
Description copied from interface: Navigator
Replaces an existing reference to a child node.

Specified by:
setChild in interface Navigator<SystemNode>

childCount

public int childCount(SystemNode node)
Description copied from interface: Navigator
Returns the number of children of the specified node.

Specified by:
childCount in interface Navigator<SystemNode>

getVisitToken

public Object getVisitToken(SystemNode node)
Description copied from interface: Navigator
Returns the visit token of the specified node. This is used to ensure that subtrees are not visited multiple times during dagification.

Specified by:
getVisitToken in interface Navigator<SystemNode>

setVisitToken

public void setVisitToken(SystemNode node,
                          Object token)
Description copied from interface: Navigator
Sets the visit token of the specified node.

Specified by:
setVisitToken in interface Navigator<SystemNode>

getHeight

public int getHeight(SystemNode node)
Description copied from interface: Navigator
Returns the height of the specified node.

Specified by:
getHeight in interface Navigator<SystemNode>

setHeight

public void setHeight(SystemNode node,
                      int height)
Description copied from interface: Navigator
Sets the height of the specified node.

Specified by:
setHeight in interface Navigator<SystemNode>


Copyright © 2010. All Rights Reserved.