Class IntrusiveDoublyLinkedStructureBase<VALUE_TYPE>

java.lang.Object
io.deephaven.util.datastructures.linked.IntrusiveDoublyLinkedStructureBase<VALUE_TYPE>
Direct Known Subclasses:
IntrusiveDoublyLinkedQueue

public abstract class IntrusiveDoublyLinkedStructureBase<VALUE_TYPE> extends Object
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.
  • 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

      @NotNull protected final VALUE_TYPE getNext(@NotNull VALUE_TYPE node)
      Get the next node after the input node.
      Parameters:
      node - The input node
      Returns:
      The input node's next node
    • setNext

      protected final void setNext(@NotNull VALUE_TYPE node, @NotNull VALUE_TYPE other)
      Set the input node's next node.
      Parameters:
      node - The input node
      other - The input node's new next node
    • getPrev

      @NotNull protected final VALUE_TYPE getPrev(@NotNull VALUE_TYPE node)
      Get the previous node before the input node.
      Parameters:
      node - The input node
      Returns:
      The input node's previous node
    • setPrev

      protected final void setPrev(@NotNull VALUE_TYPE node, @NotNull VALUE_TYPE other)
      Set the input node's previous node.
      Parameters:
      node - The input node
      other - The input node's new previous node
    • isLinked

      protected final boolean isLinked(@NotNull VALUE_TYPE node)
      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

      @NotNull protected final VALUE_TYPE linkBefore(@NotNull VALUE_TYPE node, @NotNull VALUE_TYPE other)
      Insert a node before another node.
      Parameters:
      node - The node to insert
      other - The node to insert before
      Returns:
      node
    • linkAfter

      @NotNull protected final VALUE_TYPE linkAfter(@NotNull VALUE_TYPE node, @NotNull VALUE_TYPE other)
      Insert a node after another node.
      Parameters:
      node - The node to insert
      other - The node to insert after
      Returns:
      node
    • unlink

      @NotNull protected final VALUE_TYPE unlink(@NotNull VALUE_TYPE node)
      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