Class LinkedNode<T extends LinkedNode<T>>
- java.lang.Object
-
- org.apache.activemq.store.kahadb.disk.util.LinkedNode<T>
-
- Direct Known Subclasses:
DataFile
,Journal.WriteCommand
,Sequence
public class LinkedNode<T extends LinkedNode<T>> extends Object
Provides a base class for you to extend when you want object to maintain a doubly linked list to other objects without using a collection class.- Author:
- chirino
-
-
Constructor Summary
Constructors Constructor Description LinkedNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getHeadNode()
LinkedNodeList<T>
getList()
T
getNext()
T
getNextCircular()
T
getPrevious()
T
getPreviousCircular()
T
getTailNode()
boolean
isHeadNode()
boolean
isLinked()
boolean
isTailNode()
void
linkAfter(LinkedNodeList<T> rightList)
void
linkAfter(T node)
void
linkBefore(LinkedNodeList<T> leftList)
void
linkBefore(T node)
void
linkToHead(LinkedNodeList<T> target)
void
linkToTail(LinkedNodeList<T> target)
LinkedNodeList<T>
splitAfter()
Splits the list into 2 lists.LinkedNodeList<T>
splitBefore()
Splits the list into 2 lists.boolean
unlink()
Removes this node out of the linked list it is chained in.
-
-
-
Field Detail
-
list
protected LinkedNodeList<T extends LinkedNode<T>> list
-
next
protected T extends LinkedNode<T> next
-
prev
protected T extends LinkedNode<T> prev
-
-
Method Detail
-
getHeadNode
public T getHeadNode()
-
getTailNode
public T getTailNode()
-
getNext
public T getNext()
-
getPrevious
public T getPrevious()
-
getNextCircular
public T getNextCircular()
-
getPreviousCircular
public T getPreviousCircular()
-
isHeadNode
public boolean isHeadNode()
-
isTailNode
public boolean isTailNode()
-
linkAfter
public void linkAfter(T node)
- Parameters:
node
- the node to link after this node.
-
linkAfter
public void linkAfter(LinkedNodeList<T> rightList)
- Parameters:
rightList
- the node to link after this node.
-
linkBefore
public void linkBefore(T node)
- Parameters:
node
- the node to link after this node.
-
linkBefore
public void linkBefore(LinkedNodeList<T> leftList)
- Parameters:
leftList
- the node to link after this node.
-
linkToTail
public void linkToTail(LinkedNodeList<T> target)
-
linkToHead
public void linkToHead(LinkedNodeList<T> target)
-
unlink
public boolean unlink()
Removes this node out of the linked list it is chained in.
-
splitAfter
public LinkedNodeList<T> splitAfter()
Splits the list into 2 lists. This node becomes the tail of this list. Then 2nd list is returned.- Returns:
- An empty list if this is a tail node.
-
splitBefore
public LinkedNodeList<T> splitBefore()
Splits the list into 2 lists. This node becomes the head of this list. Then 2nd list is returned.- Returns:
- An empty list if this is a head node.
-
isLinked
public boolean isLinked()
-
getList
public LinkedNodeList<T> getList()
-
-