Revision: 7484
Author: victormote
Date: 2006-06-09 14:18:19 -0700 (Fri, 09 Jun 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7484&view=rev
Log Message:
-----------
Clean up doc a bit.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-06-09 19:35:47 UTC (rev 7483)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2006-06-09 21:18:19 UTC (rev 7484)
@@ -36,7 +36,7 @@
* traversal needs.
*
* <p>Consideration was given to using
- * javax.swing.tree.DefaultMutableTreeNode instead of creating this class.
+ * {@link DefaultMutableTreeNode} instead of creating this class.
* However, the data portion of that class was not deemed suitable.</p>
*/
public abstract class OrderedTreeNode
@@ -92,6 +92,9 @@
this.parent = parent;
}
+ /**
+ * {@inheritDoc}
+ */
public Enumeration children() {
if (getChildren() == null || getChildren().size() == 0) {
return EMPTY_ENUMERATION;
@@ -99,10 +102,19 @@
return new ListEnumeration(getChildren());
}
+ /**
+ * {@inheritDoc}
+ */
public abstract List getChildren();
+ /**
+ * {@inheritDoc}
+ */
public abstract boolean getAllowsChildren();
+ /**
+ * {@inheritDoc}
+ */
public TreeNode getChildAt(int childIndex) {
if (childIndex < 0) {
return null;
@@ -113,6 +125,9 @@
return (TreeNode) getChildren().get(childIndex);
}
+ /**
+ * {@inheritDoc}
+ */
public int getChildCount() {
if (getChildren() == null) {
return 0;
@@ -120,6 +135,9 @@
return getChildren().size();
}
+ /**
+ * {@inheritDoc}
+ */
public int getIndex(TreeNode node) {
if (getChildren() == null) {
return -1;
@@ -127,10 +145,16 @@
return getChildren().indexOf(node);
}
+ /**
+ * {@inheritDoc}
+ */
public TreeNode getParent() {
return this.parent;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isLeaf() {
if (getChildCount() < 1) {
return true;
@@ -138,6 +162,9 @@
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public List getSiblings() {
if (parent == null) {
return null;
@@ -150,7 +177,7 @@
}
/**
- * @return The index to "this" in the parent's children.
+ * {@inheritDoc}
*/
public int siblingIndex() {
List siblings = getSiblings();
@@ -161,8 +188,7 @@
}
/**
- * @return Return the sibling immediately preceding "this" in the parent's
- * children, or null if this is the first child.
+ * {@inheritDoc}
*/
public org.axsl.common.OrderedTreeNode getPreviousSibling() {
int mySiblingIndex = siblingIndex();
@@ -173,8 +199,7 @@
}
/**
- * @return Return the sibling immediately following "this" in the parent's
- * children, or null if this is the last child.
+ * {@inheritDoc}
*/
public org.axsl.common.OrderedTreeNode getNextSibling() {
int mySiblingIndex = siblingIndex();
@@ -188,12 +213,16 @@
return (OrderedTreeNode) getSiblings().get(mySiblingIndex + 1);
}
+ /**
+ * Changes this nodes parent.
+ * @param newParent The new parent of this node.
+ */
public void setParent(OrderedTreeNode newParent) {
this.parent = newParent;
}
/**
- * @return True if this AreaNode has any children, false if it has none.
+ * {@inheritDoc}
*/
public boolean hasChildren() {
if (getChildCount() > 0) {
@@ -202,6 +231,9 @@
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public org.axsl.common.OrderedTreeNode getFirstChild() {
List children = getChildren();
if (children == null) {
@@ -213,6 +245,9 @@
return (OrderedTreeNode) children.get(0);
}
+ /**
+ * {@inheritDoc}
+ */
public org.axsl.common.OrderedTreeNode getLastChild() {
List children = getChildren();
if (children == null) {
@@ -225,9 +260,7 @@
}
/**
- * Returns the next node in the tree relative to the current node, in
- * pre-order traversal order. This is also known as breadth-first order.
- * @return The next pre-order node, or null if there is none.
+ * {@inheritDoc}
*/
public org.axsl.common.OrderedTreeNode nextPreOrderNode() {
// Any children?
@@ -248,14 +281,8 @@
}
/**
- * Finds and returns the first leaf that is a descendant of this node --
- * either this node or its first child's first leaf.
- * Returns this node if it is a leaf.
- * (Liberated from {@link DefaultMutableTreeNode}).
- *
- * @see #isLeaf
- * @see DefaultMutableTreeNode#isNodeDescendant
- * @return the first leaf in the subtree rooted at this node
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public org.axsl.common.OrderedTreeNode getFirstLeaf() {
org.axsl.common.OrderedTreeNode node = this;
@@ -265,16 +292,9 @@
return node;
}
-
/**
- * Finds and returns the last leaf that is a descendant of this node --
- * either this node or its last child's last leaf.
- * Returns this node if it is a leaf.
- * (Liberated from {@link DefaultMutableTreeNode}).
- *
- * @see #isLeaf
- * @see DefaultMutableTreeNode#isNodeDescendant
- * @return the last leaf in the subtree rooted at this node
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public org.axsl.common.OrderedTreeNode getLastLeaf() {
org.axsl.common.OrderedTreeNode node = this;
@@ -284,26 +304,9 @@
return node;
}
-
/**
- * Returns the leaf after this node or null if this node is the
- * last leaf in the tree.
- * <p>
- * In this implementation of the <code>MutableNode</code> interface,
- * this operation is very inefficient. In order to determine the
- * next node, this method first performs a linear search in the
- * parent's child-list in order to find the current node.
- * <p>
- * That implementation makes the operation suitable for short
- * traversals from a known position. But to traverse all of the
- * leaves in the tree, you should use <code>depthFirstEnumeration</code>
- * to enumerate the nodes in the tree and use <code>isLeaf</code>
- * on each node to determine which are leaves.
- * (Liberated from {@link DefaultMutableTreeNode}).
- *
- * @see DefaultMutableTreeNode#depthFirstEnumeration
- * @see #isLeaf
- * @return returns the next leaf past this node
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public org.axsl.common.OrderedTreeNode getNextLeaf() {
org.axsl.common.OrderedTreeNode nextSibling;
@@ -318,26 +321,9 @@
return myParent.getNextLeaf(); // tail recursion
}
-
/**
- * Returns the leaf before this node or null if this node is the
- * first leaf in the tree.
- * <p>
- * In this implementation of the <code>MutableNode</code> interface,
- * this operation is very inefficient. In order to determine the
- * previous node, this method first performs a linear search in the
- * parent's child-list in order to find the current node.
- * <p>
- * That implementation makes the operation suitable for short
- * traversals from a known position. But to traverse all of the
- * leaves in the tree, you should use <code>depthFirstEnumeration</code>
- * to enumerate the nodes in the tree and use <code>isLeaf</code>
- * on each node to determine which are leaves.
- * (Liberated from {@link DefaultMutableTreeNode}).
- *
- * @see DefaultMutableTreeNode#depthFirstEnumeration
- * @see #isLeaf
- * @return returns the leaf before this node
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public org.axsl.common.OrderedTreeNode getPreviousLeaf() {
org.axsl.common.OrderedTreeNode previousSibling;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|