You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2006/01/21 02:44:01 UTC
svn commit: r370950 -
/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/TreeList.java
Author: scolebourne
Date: Fri Jan 20 17:43:58 2006
New Revision: 370950
URL: http://svn.apache.org/viewcvs?rev=370950&view=rev
Log:
Comments and formatting
Modified:
jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/TreeList.java
Modified: jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/TreeList.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/TreeList.java?rev=370950&r1=370949&r2=370950&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/TreeList.java (original)
+++ jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/TreeList.java Fri Jan 20 17:43:58 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2005 The Apache Software Foundation
+ * Copyright 2004-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -524,9 +524,15 @@
return balance();
}
+ /**
+ * Removes this node from the tree.
+ *
+ * @return the node that replaces this one in the parent
+ */
private AVLNode removeSelf() {
- if (getRightSubTree() == null && getLeftSubTree() == null)
+ if (getRightSubTree() == null && getLeftSubTree() == null) {
return null;
+ }
if (getRightSubTree() == null) {
if (relativePosition > 0) {
left.relativePosition += relativePosition + (relativePosition > 0 ? 0 : 1);
@@ -541,6 +547,7 @@
}
if (heightRightMinusLeft() > 0) {
+ // more on the right, so delete from the right
AVLNode rightMin = right.min();
value = rightMin.value;
if (leftIsPrevious) {
@@ -551,6 +558,7 @@
relativePosition++;
}
} else {
+ // more on the left or equal, so delete from the left
AVLNode leftMax = left.max();
value = leftMax.value;
if (rightIsNext) {
@@ -669,12 +677,24 @@
return newTop;
}
+ /**
+ * Sets the left field to the node, or the previous node if that is null
+ *
+ * @param node the new left subtree node
+ * @param previous the previous node in the linked list
+ */
private void setLeft(AVLNode node, AVLNode previous) {
leftIsPrevious = (node == null);
left = (leftIsPrevious ? previous : node);
recalcHeight();
}
+ /**
+ * Sets the right field to the node, or the next node if that is null
+ *
+ * @param node the new left subtree node
+ * @param next the next node in the linked list
+ */
private void setRight(AVLNode node, AVLNode next) {
rightIsNext = (node == null);
right = (rightIsNext ? next : node);
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org