Class IntrusiveDoublyLinkedStructureBase<VALUE_TYPE>
java.lang.Object
io.deephaven.util.datastructures.linked.IntrusiveDoublyLinkedStructureBase<VALUE_TYPE>
- Direct Known Subclasses:
IntrusiveDoublyLinkedQueue
Circular doubly-linked structure base. Intended as a utility for building other structures.
Note that "unlinked" nodes should have themselves as their next and previous nodes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Adapter interface for nodes with intrusively-stored previous and next nodes. -
Constructor Summary
ModifierConstructorDescriptionprotected
IntrusiveDoublyLinkedStructureBase
(@NotNull IntrusiveDoublyLinkedStructureBase.Adapter<VALUE_TYPE> adapter) Constructor, for sub-class use only. -
Method Summary
Modifier and TypeMethodDescriptionprotected final boolean
compatible
(@NotNull IntrusiveDoublyLinkedStructureBase<VALUE_TYPE> other) 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.protected final VALUE_TYPE
getNext
(VALUE_TYPE node) Get the next node after the input node.protected final VALUE_TYPE
getPrev
(VALUE_TYPE node) Get the previous node before the input node.protected final boolean
isLinked
(VALUE_TYPE node) Test if a node is part of a structure.protected final VALUE_TYPE
linkAfter
(VALUE_TYPE node, VALUE_TYPE other) Insert a node after another node.protected final VALUE_TYPE
linkBefore
(VALUE_TYPE node, VALUE_TYPE other) Insert a node before another node.protected final void
setNext
(VALUE_TYPE node, VALUE_TYPE other) Set the input node's next node.protected final void
setPrev
(VALUE_TYPE node, VALUE_TYPE other) Set the input node's previous node.protected final VALUE_TYPE
unlink
(VALUE_TYPE node) Remove a node from a structure.
-
Constructor Details
-
IntrusiveDoublyLinkedStructureBase
protected IntrusiveDoublyLinkedStructureBase(@NotNull @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
protected final boolean compatible(@NotNull @NotNull IntrusiveDoublyLinkedStructureBase<VALUE_TYPE> other) 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
-