activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r740329 - /activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LinkedNodeList.java
Date Tue, 03 Feb 2009 16:02:01 GMT
Author: chirino
Date: Tue Feb  3 16:02:01 2009
New Revision: 740329

URL: http://svn.apache.org/viewvc?rev=740329&view=rev
Log:
Added a handy little rotateTo method to be able to quickly rotate to a specific node.

Modified:
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LinkedNodeList.java

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LinkedNodeList.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LinkedNodeList.java?rev=740329&r1=740328&r2=740329&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LinkedNodeList.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LinkedNodeList.java Tue Feb
 3 16:02:01 2009
@@ -105,6 +105,17 @@
         return head = head.getNextCircular();
     }
 
+    /**
+     * Move the head to the tail and returns the new head node.
+     * 
+     * @return
+     */
+    public void rotateTo(T head) {
+    	assert head!=null: "Cannot rotate to a null head";
+    	assert head.list == this : "Cannot rotate to a node not linked to this list";
+        this.head = head;
+    }
+
     public int size() {
         return size;
     }



Mime
View raw message