qflib 0.98.1

de.qfs.lib.tree
Interface Traversal

All Known Subinterfaces:
MutableTraversal
All Known Implementing Classes:
AbstractTraversal

public interface Traversal

This interface is implemented by classes that traverse a tree.

Since:
0.98.1
Version:
$Revision: 1.2 $
Author:
Gregor Schmid

Method Summary
 void finish()
          Cleanly abort the traversal.
 TreeAdapter getAdapter()
          Get the TreeAdapter of the tree being traversed.
 int getIndex()
          Get the index of the current node in its parent.
 java.lang.Object getNode()
          Get the current node of the traversal.
 java.lang.Object getParent()
          Get the parent node of the traversal.
 java.lang.Object[] getPath()
          Get the path of the current node realtive to the node the traversal was started at.
 java.lang.Object getPreviousSibling()
          Get the previous sibling of the current node.
 java.lang.Object getUserObject()
          Get a user object associated with this traversal.
 void setUserObject(java.lang.Object object)
          Set a user object associated with this traversal.
 

Method Detail

getAdapter

public TreeAdapter getAdapter()
Get the TreeAdapter of the tree being traversed.
Returns:
The TreeAdapter of the tree being traversed.

getNode

public java.lang.Object getNode()
Get the current node of the traversal.
Returns:
The current node of the traversal.

getParent

public java.lang.Object getParent()
Get the parent node of the traversal.
Returns:
The parent node of the traversal.

getIndex

public int getIndex()
Get the index of the current node in its parent. Depending on the type of the adapter this method may perform better than TreeAdapter.getIndexOfChildNode.
Returns:
The index of the node in its parent.

getPath

public java.lang.Object[] getPath()
Get the path of the current node realtive to the node the traversal was started at.
Returns:
The path of the current node.

getPreviousSibling

public java.lang.Object getPreviousSibling()
Get the previous sibling of the current node.
Returns:
The previous sibling of the current node.

finish

public void finish()
Cleanly abort the traversal.

getUserObject

public java.lang.Object getUserObject()
Get a user object associated with this traversal. Useful for communication between different nodes during traversal.
Returns:
The user object associated with this traversal.

setUserObject

public void setUserObject(java.lang.Object object)
Set a user object associated with this traversal. Useful for communication between different nodes during traversal.
Parameters:
object - The user object to set.

qflib 0.98.1