You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/12/21 22:19:56 UTC
svn commit: r1051656 - in
/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list:
LinkedNode.java LinkedNodeList.java
Author: chirino
Date: Tue Dec 21 21:19:55 2010
New Revision: 1051656
URL: http://svn.apache.org/viewvc?rev=1051656&view=rev
Log:
assist hotspot.
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNodeList.java
Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java?rev=1051656&r1=1051655&r2=1051656&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNode.java Tue Dec 21 21:19:55 2010
@@ -32,39 +32,39 @@ public class LinkedNode<T extends Linked
}
@SuppressWarnings("unchecked")
- private T getThis() {
+ final private T getThis() {
return (T) this;
}
- public T getHeadNode() {
+ final public T getHeadNode() {
return list.head;
}
- public T getTailNode() {
+ final public T getTailNode() {
return list.head.prev;
}
- public T getNext() {
+ final public T getNext() {
return isTailNode() ? null : next;
}
- public T getPrevious() {
+ final public T getPrevious() {
return isHeadNode() ? null : prev;
}
- public T getNextCircular() {
+ final public T getNextCircular() {
return next;
}
- public T getPreviousCircular() {
+ final public T getPreviousCircular() {
return prev;
}
- public boolean isHeadNode() {
+ final public boolean isHeadNode() {
return list.head == this;
}
- public boolean isTailNode() {
+ final public boolean isTailNode() {
return list.head.prev == this;
}
@@ -73,7 +73,7 @@ public class LinkedNode<T extends Linked
* the node to link after this node.
* @return this
*/
- public void linkAfter(T node) {
+ final public void linkAfter(T node) {
if (node == this) {
throw new IllegalArgumentException("You cannot link to yourself");
}
@@ -99,7 +99,7 @@ public class LinkedNode<T extends Linked
* the node to link after this node.
* @return this
*/
- public void linkAfter(LinkedNodeList<T> rightList) {
+ final public void linkAfter(LinkedNodeList<T> rightList) {
if (rightList == list) {
throw new IllegalArgumentException("You cannot link to yourself");
@@ -125,7 +125,7 @@ public class LinkedNode<T extends Linked
* @return
* @return this
*/
- public void linkBefore(T node) {
+ final public void linkBefore(T node) {
if (node == this) {
throw new IllegalArgumentException("You cannot link to yourself");
@@ -157,7 +157,7 @@ public class LinkedNode<T extends Linked
* @return
* @return this
*/
- public void linkBefore(LinkedNodeList<T> leftList) {
+ final public void linkBefore(LinkedNodeList<T> leftList) {
if (leftList == list) {
throw new IllegalArgumentException("You cannot link to yourself");
@@ -181,7 +181,7 @@ public class LinkedNode<T extends Linked
}
}
- public void linkToTail(LinkedNodeList<T> target) {
+ final public void linkToTail(LinkedNodeList<T> target) {
if (list != null) {
throw new IllegalArgumentException("This node is already linked to a node");
}
@@ -195,7 +195,7 @@ public class LinkedNode<T extends Linked
}
}
- public void linkToHead(LinkedNodeList<T> target) {
+ final public void linkToHead(LinkedNodeList<T> target) {
if (list != null) {
throw new IllegalArgumentException("This node is already linked to a node");
}
@@ -212,7 +212,7 @@ public class LinkedNode<T extends Linked
/**
* Removes this node out of the linked list it is chained in.
*/
- public boolean unlink() {
+ final public boolean unlink() {
// If we are allready unlinked...
if (list == null) {
@@ -242,7 +242,7 @@ public class LinkedNode<T extends Linked
*
* @return An empty list if this is a tail node.
*/
- public LinkedNodeList<T> splitAfter() {
+ final public LinkedNodeList<T> splitAfter() {
if (isTailNode()) {
return new LinkedNodeList<T>();
@@ -280,7 +280,7 @@ public class LinkedNode<T extends Linked
*
* @return An empty list if this is a head node.
*/
- public LinkedNodeList<T> splitBefore() {
+ final public LinkedNodeList<T> splitBefore() {
if (isHeadNode()) {
return new LinkedNodeList<T>();
@@ -313,11 +313,11 @@ public class LinkedNode<T extends Linked
return newList;
}
- public boolean isLinked() {
+ final public boolean isLinked() {
return list != null;
}
- public LinkedNodeList<T> getList() {
+ final public LinkedNodeList<T> getList() {
return list;
}
Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNodeList.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNodeList.java?rev=1051656&r1=1051655&r2=1051656&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNodeList.java (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/list/LinkedNodeList.java Tue Dec 21 21:19:55 2010
@@ -32,36 +32,36 @@ public class LinkedNodeList<T extends Li
public LinkedNodeList() {
}
- public boolean isEmpty() {
+ final public boolean isEmpty() {
return head == null;
}
- public void addLast(T node) {
+ final public void addLast(T node) {
node.linkToTail(this);
}
- public void addFirst(T node) {
+ final public void addFirst(T node) {
node.linkToHead(this);
}
- public T getHead() {
+ final public T getHead() {
return head;
}
- public T getTail() {
+ final public T getTail() {
if( head==null ) {
return null;
}
return head.prev;
}
- public void clear() {
+ final public void clear() {
while (head != null) {
head.unlink();
}
}
- public void addLast(LinkedNodeList<T> list) {
+ final public void addLast(LinkedNodeList<T> list) {
if (list.isEmpty()) {
return;
}
@@ -73,7 +73,7 @@ public class LinkedNodeList<T extends Li
}
}
- public void addFirst(LinkedNodeList<T> list) {
+ final public void addFirst(LinkedNodeList<T> list) {
if (list.isEmpty()) {
return;
}
@@ -86,7 +86,7 @@ public class LinkedNodeList<T extends Li
}
}
- public T reparent(LinkedNodeList<T> list) {
+ final public T reparent(LinkedNodeList<T> list) {
size += list.size;
T n = list.head;
do {
@@ -103,7 +103,7 @@ public class LinkedNodeList<T extends Li
*
* @return
*/
- public T rotate() {
+ final public T rotate() {
if( head ==null )
return null;
return head = head.getNextCircular();
@@ -114,7 +114,7 @@ public class LinkedNodeList<T extends Li
*
* @return
*/
- public void rotateTo(T head) {
+ final 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;
@@ -125,7 +125,7 @@ public class LinkedNodeList<T extends Li
}
@Override
- public String toString() {
+ final public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
boolean first=true;
@@ -146,7 +146,7 @@ public class LinkedNodeList<T extends Li
* Copies the nodes of the LinkedNodeList to an ArrayList.
* @return
*/
- public ArrayList<T> toArrayList() {
+ final public ArrayList<T> toArrayList() {
ArrayList<T> rc = new ArrayList<T>(size);
T cur = head;
while( cur!=null ) {
@@ -160,7 +160,7 @@ public class LinkedNodeList<T extends Li
* Copies the nodes of the LinkedNodeList to an ArrayList in reverse order.
* @return
*/
- public ArrayList<T> toArrayListReversed() {
+ final public ArrayList<T> toArrayListReversed() {
ArrayList<T> rc = new ArrayList<T>(size);
if( head != null ) {
T cur = getTail();;
@@ -177,7 +177,7 @@ public class LinkedNodeList<T extends Li
* Copies the nodes of the LinkedNodeList to the specified array.
* @return the passed array.
*/
- public T[] toArray(T[] array) {
+ final public T[] toArray(T[] array) {
int pos = 0;
ArrayList<T> rc = new ArrayList<T>(size);
T cur = head;
@@ -189,7 +189,7 @@ public class LinkedNodeList<T extends Li
return array;
}
- public Iterator<T> iterator() {
+ final public Iterator<T> iterator() {
return new Iterator<T>() {
T next = getHead();
private T last;