net.sf.extjwnl.data.list
Class PointerTargetTree

java.lang.Object
  extended by net.sf.extjwnl.data.list.PointerTargetTree

public class PointerTargetTree
extends Object

A container for the root node of a pointer target tree.

Author:
John Didion , Aliaksandr Autayeu

Constructor Summary
PointerTargetTree(PointerTargetTreeNode rootNode)
           
PointerTargetTree(Synset synset, PointerTargetTreeNodeList list)
           
 
Method Summary
 boolean equals(Object obj)
          Two PointerTargetTree's are equal if their root nodes are equal.
 List<PointerTargetTreeNode> findAll(PointerTarget target)
          Finds all nodes in the tree whose target is target.
 List<PointerTargetTreeNode> findAll(PointerTargetTreeNode node)
          Finds all occurrences of node in the tree.
 PointerTargetTreeNode findFirst(PointerTarget target)
          Finds the first node in the tree whose target is target.
 PointerTargetTreeNode findFirst(PointerTargetTreeNode node)
          Finds the first occurrence of node in the tree.
 List<PointerTargetTreeNode> getAllMatches(PointerTargetTreeNodeList.Operation opr)
          Walks the tree and performs the operation opr on each node.
 PointerTargetTreeNode getFirstMatch(PointerTargetTreeNodeList.Operation opr)
          Walks the tree and performs the operation opr on each node.
 PointerTargetTreeNode getRootNode()
           
 void print()
           
 List<PointerTargetNodeList> reverse()
          Reverse this tree.
 List<PointerTargetNodeList> toList()
          Convert this tree to a list of PointerTargetNodeLists.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointerTargetTree

public PointerTargetTree(PointerTargetTreeNode rootNode)

PointerTargetTree

public PointerTargetTree(Synset synset,
                         PointerTargetTreeNodeList list)
Method Detail

getRootNode

public PointerTargetTreeNode getRootNode()

equals

public boolean equals(Object obj)
Two PointerTargetTree's are equal if their root nodes are equal.

Overrides:
equals in class Object

getFirstMatch

public PointerTargetTreeNode getFirstMatch(PointerTargetTreeNodeList.Operation opr)
Walks the tree and performs the operation opr on each node. Continues until either opr returns a non-null value, or it reaches the last node in the tree.

Parameters:
opr - operation to execute
Returns:
operation result

getAllMatches

public List<PointerTargetTreeNode> getAllMatches(PointerTargetTreeNodeList.Operation opr)
Walks the tree and performs the operation opr on each node. Searches the tree exhaustively and returns a List containing all nodes that are returned by opr.

Parameters:
opr - operation to execute
Returns:
list of operation results

findFirst

public PointerTargetTreeNode findFirst(PointerTargetTreeNode node)
Finds the first occurrence of node in the tree.

Parameters:
node - node to search for
Returns:
the first occurrence of node in the tree

findFirst

public PointerTargetTreeNode findFirst(PointerTarget target)
Finds the first node in the tree whose target is target.

Parameters:
target - target to search for
Returns:
the first node in the tree whose target is target

findAll

public List<PointerTargetTreeNode> findAll(PointerTargetTreeNode node)
Finds all occurrences of node in the tree.

Parameters:
node - node to search for
Returns:
all occurrences of node in the tree

findAll

public List<PointerTargetTreeNode> findAll(PointerTarget target)
Finds all nodes in the tree whose target is target.

Parameters:
target - target to search for
Returns:
all nodes in the tree whose target is target

print

public void print()

reverse

public List<PointerTargetNodeList> reverse()
Reverse this tree. A reversal is done by converting this tree to lists and then reversing each of the lists. The structure of the tree is unaffected by this operation.

Returns:
reversed lists

toList

public List<PointerTargetNodeList> toList()
Convert this tree to a list of PointerTargetNodeLists. This creates one list for each unique path through the tree.

Returns:
list of PointerTargetNodeLists


Copyright © 2011. All Rights Reserved.