Class dnx.lr.InstanceTraversal
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dnx.lr.InstanceTraversal

java.lang.Object
   |
   +----dnx.util.DNXObject
           |
           +----dnx.util.DNXInstancedObject
                   |
                   +----dnx.lr.Action
                           |
                           +----dnx.lr.Traversal
                                   |
                                   +----dnx.lr.InstanceTraversal

public class InstanceTraversal
extends Traversal
implements ChildInstanceMapper
An InstanceTraversal searches over the scene graph of node instances. If a node is instanced multiple times, this will visit each instance. Note that the NodeInstance object passed to the various callbacks below may not be unique to this particular instance; however, if an instance is ever returned, unique NodeInstance objects for that instance, and for all parent instances back to the root, need to be created so that there is a unique path to the NodeInstance object. This is done with the InstanceReturningTraversal type. If you want to traverse over only the currently existing NodeInstance objects, do a node traversal and iterate over each instance object attached to the node.

Variable Index

 o mapDataValue
Value passed as mapData; normally the traversal object itself.

Constructor Index

 o InstanceTraversal()
Construct a traversal with a group traversal type and default nodes interest.
 o InstanceTraversal(int)
Construct a traversal with a specified traversal type and default context interest.
 o InstanceTraversal(int, int)
Construct a traversal with a specified traversal type and context interest.

Method Index

 o begin(NodeInstance)
begin() is called when a traversal is about to begin.
 o childInstanceMapperCallback(NodeInstance, NodeInstance, int, int, Object)
You should definitely not call this yourself.
 o end(NodeInstance)
end() is called when a traversal has just finished.
 o enter(NodeInstance)
enter() is called when an MFNode or SFNode field is entered during traversal.
 o leave(NodeInstance)
leave() is called when an MFNode or SFNode field is left during traversal.
 o traverse(NodeInstance)
 o visit(NodeInstance)
visit() is called when a node instance is visited during traversal.

Variables

 o mapDataValue
  protected Object mapDataValue
Value passed as mapData; normally the traversal object itself. Uninterpreted by childInstanceMapperCallback() so it can be anything you want.

Constructors

 o InstanceTraversal
  public InstanceTraversal()
Construct a traversal with a group traversal type and default nodes interest.
 o InstanceTraversal
  public InstanceTraversal(int traversalType)
Construct a traversal with a specified traversal type and default context interest.
 o InstanceTraversal
  public InstanceTraversal(int traversalType,
                           int contextInterest)
Construct a traversal with a specified traversal type and context interest.

Methods

 o traverse
  public boolean traverse(NodeInstance inst)
 o begin
  public void begin(NodeInstance inst)
begin() is called when a traversal is about to begin. INST is the root node instance of the tree that is being traversed. You should reset anything that tracks state over the duration of the traversal -- remember that the same traversal object can be used multiple times. If you override this, you *MUST* call this superclass begin method. Don't call this yourself. It's called automatically.
 o end
  public void end(NodeInstance inst)
end() is called when a traversal has just finished. INST is the root node instance of the tree that is being traversed. If you override this, you *MUST* call this superclass end method. Don't call this yourself. It's called automatically.
 o visit
  public abstract int visit(NodeInstance inst)
visit() is called when a node instance is visited during traversal. The return value should be one of the three constants CONTINUE, STOP, or PRUNE. Don't call this yourself. It's called automatically. CONTINUE == continue traversing STOP == stop traversing PRUNE == don't traverse any children of this node, but otherwise continue @param inst the node instance being visited
 o enter
  public void enter(NodeInstance inst)
enter() is called when an MFNode or SFNode field is entered during traversal. This happens after the node containing the field is visited, and before visiting any of the child nodes within the field. If you override this, you *MUST* call this superclass enter method. Don't call this yourself. It's called automatically. @param inst the node instance whose field is being entered @param nodeInd the index of the instance within its containing field @param fieldInd the index of the field being entered
 o leave
  public void leave(NodeInstance inst)
leave() is called when an MFNode or SFNode field is left during traversal. This happens right after visiting the last child node in the field. If you override this, you *MUST* call this superclass leave method. Don't call this yourself. It's called automatically.
 o childInstanceMapperCallback
  public NodeInstance childInstanceMapperCallback(NodeInstance child,
                                                  NodeInstance parent,
                                                  int fieldind,
                                                  int nodeind,
                                                  Object mapData)
You should definitely not call this yourself. Override this if you want to change the way the traversal works.

All Packages  Class Hierarchy  This Package  Previous  Next  Index