net.sf.mmm.util.collection.base
Class AbstractLinkedNode<V,NODE extends AbstractLinkedNode<V,NODE>>

java.lang.Object
  extended by net.sf.mmm.util.collection.base.AbstractLinkedNode<V,NODE>
Type Parameters:
V - is the generic type of the value of this node.
NODE - is the generic type of the node itself.
All Implemented Interfaces:
LinkedNode<V,NODE>
Direct Known Subclasses:
BasicDoubleLinkedNode, BasicLinkedNode

public abstract class AbstractLinkedNode<V,NODE extends AbstractLinkedNode<V,NODE>>
extends Object
implements LinkedNode<V,NODE>

This is the abstract base-implementation of the LinkedNode interface.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  NODE next
           
private  V value
           
 
Constructor Summary
AbstractLinkedNode()
          The constructor.
 
Method Summary
 void addToList(List<V> list)
          This method appends the values of the list represented by this node to the given list.
 NODE getNext()
          This method gets the next node of the linked list.
 V getValue()
          This method gets the actual value of this node.
 boolean isLinked()
          This method determines if this node is linked.
 void setNext(NODE next)
          This method sets the next node.
 void setValue(V value)
          This method sets the value.
 List<V> toList()
          This method converts the list represented by this node to a regular List.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private V value
See Also:
getValue()

next

private NODE extends AbstractLinkedNode<V,NODE> next
See Also:
getNext()
Constructor Detail

AbstractLinkedNode

public AbstractLinkedNode()
The constructor.

Method Detail

getNext

public NODE getNext()
This method gets the next node of the linked list.

Specified by:
getNext in interface LinkedNode<V,NODE extends AbstractLinkedNode<V,NODE>>
Returns:
the next node or null if this is the last node (tail).

setNext

public void setNext(NODE next)
This method sets the next node.

Parameters:
next - is the next to set. May be null to indicate that this is the last node of the list.

getValue

public V getValue()
This method gets the actual value of this node.

Specified by:
getValue in interface LinkedNode<V,NODE extends AbstractLinkedNode<V,NODE>>
Returns:
the value, may be null.

setValue

public void setValue(V value)
This method sets the value.

Parameters:
value - is the value to set. May be null.

isLinked

public boolean isLinked()
This method determines if this node is linked. A node is linked if it has a next node.

Specified by:
isLinked in interface LinkedNode<V,NODE extends AbstractLinkedNode<V,NODE>>
Returns:
true if linked, false otherwise.

addToList

public void addToList(List<V> list)
This method appends the values of the list represented by this node to the given list.
Call this method on the head-node with an empty List to convert a LinkedNode-list to a regular List.

Specified by:
addToList in interface LinkedNode<V,NODE extends AbstractLinkedNode<V,NODE>>
Parameters:
list - is where to append the values.

toList

public List<V> toList()
This method converts the list represented by this node to a regular List.

Specified by:
toList in interface LinkedNode<V,NODE extends AbstractLinkedNode<V,NODE>>
Returns:
the List of all values of the list represented by this node.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.