activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r961164 - in /activemq/sandbox/activemq-apollo-actor: activemq-store/src/main/scala/org/apache/activemq/apollo/store/QueueEntryRange.java activemq-util/src/main/scala/org/apache/activemq/util/list/LinkedNodeList.java
Date Wed, 07 Jul 2010 04:12:49 GMT
Author: chirino
Date: Wed Jul  7 04:12:48 2010
New Revision: 961164

URL: http://svn.apache.org/viewvc?rev=961164&view=rev
Log:
added a handy toArray method to fill an array with the contents of the list.

Added:
    activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/QueueEntryRange.java
Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/util/list/LinkedNodeList.java

Added: activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/QueueEntryRange.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/QueueEntryRange.java?rev=961164&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/QueueEntryRange.java
(added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-store/src/main/scala/org/apache/activemq/apollo/store/QueueEntryRange.java
Wed Jul  7 04:12:48 2010
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.apollo.store;
+
+import org.fusesource.hawtbuf.Buffer;
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class QueueEntryRange {
+    public long firstSeq;
+    public long lastSeq;
+    public int count;
+    public int size;
+}
\ No newline at end of file

Modified: activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/util/list/LinkedNodeList.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/util/list/LinkedNodeList.java?rev=961164&r1=961163&r2=961164&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/util/list/LinkedNodeList.java
(original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-util/src/main/scala/org/apache/activemq/util/list/LinkedNodeList.java
Wed Jul  7 04:12:48 2010
@@ -172,6 +172,23 @@ public class LinkedNodeList<T extends Li
         return rc;
     }
 
+
+    /**
+     * Copies the nodes of the LinkedNodeList to the specified array.
+     * @return the passed array.
+     */
+    public T[] toArray(T[] array) {
+        int pos = 0;
+    	ArrayList<T> rc = new ArrayList<T>(size);
+    	T cur = head;
+    	while( cur!=null ) {
+    		array[pos] = cur;
+            pos ++;
+    		cur = cur.getNext();
+    	}
+        return array;
+    }
+    
     public Iterator<T> iterator() {
         return new Iterator<T>() {
             T next = getHead();



Mime
View raw message