Class IntrusiveDoublyLinkedStructureBase<VALUE_TYPE>
java.lang.Object
com.illumon.util.datastructures.linked.IntrusiveDoublyLinkedStructureBase<VALUE_TYPE>
- Direct Known Subclasses:
IntrusiveDoublyLinkedQueue
Circular doubly-linked structure base, based loosely on DoubleLinkedCircularListNode and
IntrusiveChainedHashAdapter. Intended as a utility for building other structures.
Note that "unlinked" nodes should have themselves as their next and previous nodes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAdapter interface for nodes with intrusively-stored previous and next nodes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor, for sub-class use only. -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanIs the other data structure compatible with this one? This is true if and only if it's the same class, with the same adapter instance.protected final VALUE_TYPEgetNext(VALUE_TYPE node) Get the next node after the input node.protected final VALUE_TYPEgetPrev(VALUE_TYPE node) Get the previous node before the input node.protected final booleanisLinked(VALUE_TYPE node) Test if a node is part of a structure.protected final VALUE_TYPElinkAfter(VALUE_TYPE node, VALUE_TYPE other) Insert a node after another node.protected final VALUE_TYPElinkBefore(VALUE_TYPE node, VALUE_TYPE other) Insert a node before another node.protected final voidsetNext(VALUE_TYPE node, VALUE_TYPE other) Set the input node's next node.protected final voidsetPrev(VALUE_TYPE node, VALUE_TYPE other) Set the input node's previous node.protected final VALUE_TYPEunlink(VALUE_TYPE node) Remove a node from a structure.
-
Constructor Details
-
IntrusiveDoublyLinkedStructureBase
protected IntrusiveDoublyLinkedStructureBase(@NotNull IntrusiveDoublyLinkedStructureBase.Adapter<VALUE_TYPE> adapter) Constructor, for sub-class use only.- Parameters:
adapter- The adapter for updating a node's next and previous nodes.
-
-
Method Details
-
getNext
Get the next node after the input node.- Parameters:
node- The input node- Returns:
- The input node's next node
-
setNext
Set the input node's next node.- Parameters:
node- The input nodeother- The input node's new next node
-
getPrev
Get the previous node before the input node.- Parameters:
node- The input node- Returns:
- The input node's previous node
-
setPrev
Set the input node's previous node.- Parameters:
node- The input nodeother- The input node's new previous node
-
isLinked
Test if a node is part of a structure.- Parameters:
node- The node to test- Returns:
- Whether the node is part of a structure (i.e. if its next node is not itself)
-
linkBefore
Insert a node before another node.- Parameters:
node- The node to insertother- The node to insert before- Returns:
- node
-
linkAfter
Insert a node after another node.- Parameters:
node- The node to insertother- The node to insert after- Returns:
- node
-
unlink
Remove a node from a structure.- Parameters:
node- The node to remove- Returns:
- node
-
compatible
Is the other data structure compatible with this one? This is true if and only if it's the same class, with the same adapter instance.- Parameters:
other- The other data structure- Returns:
- Whether other is compatible
-