org.annotation.util
Class SortedTreeNode

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended byorg.annotation.util.SortedTreeNode
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, javax.swing.tree.MutableTreeNode, java.io.Serializable, TreeComparable, javax.swing.tree.TreeNode
Direct Known Subclasses:
AnnotationTreeNode

public class SortedTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements TreeComparable

SortedTreeNode is a data structure to have a sorted tree structure. Nodes are inserted such that any node which is contained by another will be one of its children. Node which are less than or grater than one another will be siblings and sibling will be kept in asscending order from left to right.

See Also:
Serialized Form

Field Summary
protected  TreeComparable data
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
SortedTreeNode(TreeComparable d)
           
 
Method Summary
 void add(javax.swing.tree.MutableTreeNode n)
          Adds a SortedTreeNode to an existing tree inserting it in its proper location.
 int compareTo(java.lang.Object o)
           
 SortedTreeNode[] getChildrenWithProperty(java.lang.String p, boolean top)
           
 SortedTreeNode[] getContainedNodesWithProperty(SortedTreeNode s, java.lang.String p, boolean top)
          Finds nodes which are contained by span s and have property p.
 SortedTreeNode[] getContainedNodesWithProperty(java.lang.String p, boolean top)
          Finds nodes which are contained by this node's span and have property p.
 SortedTreeNode getContainerNodeWithProperty(java.lang.String p)
          Finds node having property p which subsumes TreeComparator tc
 SortedTreeNode getNode(SortedTreeNode node)
           
 boolean gt(java.lang.Object o)
          Determines whether this is greater than o.
 boolean hasProperty(java.lang.String p)
           
 boolean intersects(java.lang.Object o)
          Determines whether this intersects o.
 boolean lt(java.lang.Object o)
          Determines whether this is less than o.
 void showIndent()
           
 void showIndent(java.lang.String indent)
           
 boolean subsumes(java.lang.Object o)
          Determines whether this subsumes o.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected TreeComparable data
Constructor Detail

SortedTreeNode

public SortedTreeNode(TreeComparable d)
Method Detail

add

public void add(javax.swing.tree.MutableTreeNode n)
Adds a SortedTreeNode to an existing tree inserting it in its proper location. The node in the tree where this node is placed is returned. This will be node unless a node in the tree with the same span already exist.


getContainerNodeWithProperty

public SortedTreeNode getContainerNodeWithProperty(java.lang.String p)
Finds node having property p which subsumes TreeComparator tc


getChildrenWithProperty

public SortedTreeNode[] getChildrenWithProperty(java.lang.String p,
                                                boolean top)

getContainedNodesWithProperty

public SortedTreeNode[] getContainedNodesWithProperty(java.lang.String p,
                                                      boolean top)
Finds nodes which are contained by this node's span and have property p. If top is true then only the top-most nodes are returned, otherwise all nodes satisfying the above criteria are returned.


getContainedNodesWithProperty

public SortedTreeNode[] getContainedNodesWithProperty(SortedTreeNode s,
                                                      java.lang.String p,
                                                      boolean top)
Finds nodes which are contained by span s and have property p. If top is true then only the top-most nodes are returned, otherwise all nodes satisfying the above criteria are returned.


hasProperty

public boolean hasProperty(java.lang.String p)

getNode

public SortedTreeNode getNode(SortedTreeNode node)

showIndent

public void showIndent()

showIndent

public void showIndent(java.lang.String indent)

subsumes

public boolean subsumes(java.lang.Object o)
Description copied from interface: TreeComparable
Determines whether this subsumes o. If this equals o then this subsumes o.

Specified by:
subsumes in interface TreeComparable

intersects

public boolean intersects(java.lang.Object o)
Description copied from interface: TreeComparable
Determines whether this intersects o.

Specified by:
intersects in interface TreeComparable

lt

public boolean lt(java.lang.Object o)
Description copied from interface: TreeComparable
Determines whether this is less than o.

Specified by:
lt in interface TreeComparable

gt

public boolean gt(java.lang.Object o)
Description copied from interface: TreeComparable
Determines whether this is greater than o.

Specified by:
gt in interface TreeComparable

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable


Copyright © 2004 Thomas Morton and Jeremy LaCivita. All Rights Reserved.