Class Node<V>

java.lang.Object
com.github.tommyettinger.ds.BinaryHeap.Node
com.github.yellowstonegames.path.Node<V>
Type Parameters:
V - the vertex type; often Coord

public class Node<V> extends com.github.tommyettinger.ds.BinaryHeap.Node
An extended version of BinaryHeap.Node that also stores a reference to the parent Graph, a vertex object of type V, a Map of neighbor Nodes to the appropriate Connection per Node, an extra List of those same Connections for faster iteration, and a lot of internal data used by algorithms in this package.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected float
    Internal; confirmed distance so far to get to this Node from the start.
    protected float
    Internal; estimated distance to get from this Node to the goal.
    protected final Graph<V>
     
    protected int
    Internal; a utility field used to store depth in some algorithms.
    protected com.github.tommyettinger.ds.ObjectList<Connection<V>>
     
    protected int
    Internal; a utility field used to distinguish which algorithm last used this Node.
    protected com.github.tommyettinger.ds.ObjectObjectMap<Node<V>, Connection<V>>
     
    protected final V
     
    protected com.github.tommyettinger.ds.ObjectList<Connection<V>>
     
    protected Node<V>
    Internal; a reference to the previous Node in a BinaryHeap.
    protected boolean
    Internal; tracking bit for whether this Node has been checked during the current algorithm.
    protected boolean
    Internal; tracking bit for whether this Node has already been visited during the current algorithm.

    Fields inherited from class com.github.tommyettinger.ds.BinaryHeap.Node

    index, value
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Node(V v, Graph<V> graph)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Connection<V>
    addEdge(Node<V> v, float weight)
     
    protected void
     
    boolean
     
    com.github.tommyettinger.ds.ObjectList<Connection<V>>
     
    protected Connection<V>
     
     
    int
     
    protected Connection<V>
     
    protected boolean
    If runID is not equal to lastRunID, this resets the internal fields visited, seen, distance, estimate, prev, and i, then sets lastRunID to runID.
     

    Methods inherited from class com.github.tommyettinger.ds.BinaryHeap.Node

    getValue

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • graph

      protected final Graph<V> graph
    • object

      protected final V object
    • neighbors

      protected com.github.tommyettinger.ds.ObjectObjectMap<Node<V>, Connection<V>> neighbors
    • outEdges

      protected com.github.tommyettinger.ds.ObjectList<Connection<V>> outEdges
    • inEdges

      protected com.github.tommyettinger.ds.ObjectList<Connection<V>> inEdges
    • visited

      protected boolean visited
      Internal; tracking bit for whether this Node has already been visited during the current algorithm.
    • seen

      protected boolean seen
      Internal; tracking bit for whether this Node has been checked during the current algorithm.
    • distance

      protected float distance
      Internal; confirmed distance so far to get to this Node from the start.
    • estimate

      protected float estimate
      Internal; estimated distance to get from this Node to the goal.
    • prev

      protected Node<V> prev
      Internal; a reference to the previous Node in a BinaryHeap.
    • i

      protected int i
      Internal; a utility field used to store depth in some algorithms.
    • lastRunID

      protected int lastRunID
      Internal; a utility field used to distinguish which algorithm last used this Node.
  • Constructor Details

    • Node

      protected Node(V v, Graph<V> graph)
  • Method Details

    • getEdge

      protected Connection<V> getEdge(Node<V> v)
    • addEdge

      protected Connection<V> addEdge(Node<V> v, float weight)
    • removeEdge

      protected Connection<V> removeEdge(Node<V> v)
    • disconnect

      protected void disconnect()
    • getConnections

      public com.github.tommyettinger.ds.ObjectList<Connection<V>> getConnections()
    • getObject

      public V getObject()
    • resetAlgorithmAttributes

      protected boolean resetAlgorithmAttributes(int runID)
      If runID is not equal to lastRunID, this resets the internal fields visited, seen, distance, estimate, prev, and i, then sets lastRunID to runID.
      Parameters:
      runID - an int that identifies which run of an algorithm is currently active
      Returns:
      true if anything was reset, or false if runID is equal to lastRunID
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class com.github.tommyettinger.ds.BinaryHeap.Node