V
- is the generic type of the value
of this node.public class BasicDoubleLinkedNode<V> extends AbstractLinkedNode<V,BasicDoubleLinkedNode<V>> implements DoubleLinkedNode<V,BasicDoubleLinkedNode<V>>
DoubleLinkedNode
interface.Modifier and Type | Field and Description |
---|---|
private BasicDoubleLinkedNode<V> |
previous |
Constructor and Description |
---|
BasicDoubleLinkedNode()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
BasicDoubleLinkedNode<V> |
getPrevious()
This method gets the previous node of the double linked list.
|
void |
insertAsNext(BasicDoubleLinkedNode<V> node)
This method inserts the given
node into the list immediately after the position represented by this node. |
BasicDoubleLinkedNode<V> |
insertAsNext(V value,
boolean overrideNullValue)
This method inserts the given
value into the list at the position represented by this node. |
void |
insertAsPrevious(BasicDoubleLinkedNode<V> node)
This method inserts the given
node into the list immediately before the position represented by this node. |
BasicDoubleLinkedNode<V> |
insertAsPrevious(V value,
boolean overrideNullValue)
This method inserts the given
value into the list at the position represented by this node. |
boolean |
isLinked()
This method determines if this node is linked.
|
void |
remove()
This method removes this node from the double linked list.
|
void |
setPrevious(BasicDoubleLinkedNode<V> previous)
This method sets the
previous node . |
addToList, getNext, getValue, setNext, setValue, toList, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addToList, getNext, getValue, toList
private BasicDoubleLinkedNode<V> previous
public BasicDoubleLinkedNode<V> getPrevious()
DoubleLinkedNode
getPrevious
in interface DoubleLinkedNode<V,BasicDoubleLinkedNode<V>>
null
if this is the first node (head).public void setPrevious(BasicDoubleLinkedNode<V> previous)
previous node
.previous
- is the previous node
to set. May be null
to indicate that this is
the first node of the list.public BasicDoubleLinkedNode<V> insertAsNext(V value, boolean overrideNullValue)
value
into the list at the position represented by this node. It will
typically create a new node containing the given value
and set it as
next
. It will guarantee the following equation:
this.IfAbstractLinkedNode.getNext()
.getPrevious()
== this
overrideNullValue
is true
and the value
of this node is null
, then
its value is set to the given value
instead of creating a new node.value
- is the value to insert.overrideNullValue
- - true
if a value
of null
should be replaced with the
given value
, false
otherwise.value
.public void insertAsNext(BasicDoubleLinkedNode<V> node)
node
into the list immediately after the position represented by this node.node
- is the node
to add.public void insertAsPrevious(BasicDoubleLinkedNode<V> node)
node
into the list immediately before the position represented by this node.node
- is the node
to add.public BasicDoubleLinkedNode<V> insertAsPrevious(V value, boolean overrideNullValue)
value
into the list at the position represented by this node. It will
typically create a new node containing the given value
and set it as
next
. It will guarantee the following equation:
this.IfAbstractLinkedNode.getNext()
.getPrevious()
== this
overrideNullValue
is true
and the value
of this node is null
, then
its value is set to the given value
instead of creating a new node.value
- is the value to insert.overrideNullValue
- - true
if a value
of null
should be replaced with the
given value
, false
otherwise.value
.public void remove()
public boolean isLinked()
LinkedNode
next node
.isLinked
in interface DoubleLinkedNode<V,BasicDoubleLinkedNode<V>>
isLinked
in interface LinkedNode<V,BasicDoubleLinkedNode<V>>
isLinked
in class AbstractLinkedNode<V,BasicDoubleLinkedNode<V>>
true
if linked, false
otherwise.Copyright © 2001–2016 mmm-Team. All rights reserved.