Class DijkstraCostItem

java.lang.Object
gov.nih.mipav.model.structures.DijkstraCostItem
All Implemented Interfaces:
Comparable<Object>

public class DijkstraCostItem extends Object implements Comparable<Object>
Contains information for a point used in the the Dijkstra minimum cost path algorithm. This class implements the Comparable interface which is required of any node to be inserted in any SortedSet implementation which is required for finding a minimum cost path.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Identifies an undefined key value.
    private boolean
    Flag is set once this sample's minimum cost has been finalized.
    private float
    Current accumulated cost in the Dijkstra algorithm.
    private float
    Current accumulated distance in the Dijkstra algorithm.
    private final int
    Non-negative unique key value identifying this point.
    private int
    This value is KEY_UNDEFINED until such time that the point has been marked visited as part of the Dijkstra algorithm.
    private int
    This is the number of samples along the minimum cost path it takes to get from the starting sample to this sample.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DijkstraCostItem(int iKey)
    Setup to associate this instance with a particular sample in the volume.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(Object kObject)
    Implementation required by the Comparable interface.
    float
    Get the current accumulated cost.
    float
    Get the current accumulated distance.
    int
    Get the unique key identifier associated with this point.
    int
    Get the unique key value for the point which is used to get to this point along the minimum cost path.
    int
    Get the number of samples along the current minimum cost path that preceed this sample in the volume.
    boolean
    Test whether or not the sample has had its cost finalized.
    void
    Mark the sample as having its cost finalized, meaning that it can no longer be updated.
    void
    Mark this sample as the beginning of the minimum cost path.
    void
    update(float fCost, float fDistance, int iKeyPrev, int iNumPrev)
    Mark this node as being visited along the minimum cost path if not already done so, but only if the point has not been marked as having its distance finalized.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • KEY_UNDEFINED

      public static final int KEY_UNDEFINED
      Identifies an undefined key value.
      See Also:
    • m_bCostFinalized

      private boolean m_bCostFinalized
      Flag is set once this sample's minimum cost has been finalized.
    • m_fCost

      private float m_fCost
      Current accumulated cost in the Dijkstra algorithm.
    • m_fDistance

      private float m_fDistance
      Current accumulated distance in the Dijkstra algorithm.
    • m_iKey

      private final int m_iKey
      Non-negative unique key value identifying this point.
    • m_iKeyPrev

      private int m_iKeyPrev
      This value is KEY_UNDEFINED until such time that the point has been marked visited as part of the Dijkstra algorithm. When it has been visited, this value identifies the key value for the point which is used to get to this point along the minimum cost path.
    • m_iNumPrev

      private int m_iNumPrev
      This is the number of samples along the minimum cost path it takes to get from the starting sample to this sample.
  • Constructor Details

    • DijkstraCostItem

      public DijkstraCostItem(int iKey)
      Setup to associate this instance with a particular sample in the volume. Initially the sample is marked as having the maximum possible distance but that its distance has not be finalized.
      Parameters:
      iKey - Value uniquely identifying this point.
  • Method Details

    • compareTo

      public int compareTo(Object kObject)
      Implementation required by the Comparable interface. Compares this object with the specified object for order.
      Specified by:
      compareTo in interface Comparable<Object>
      Parameters:
      kObject - the object to be compared
      Returns:
      a negative (positive) integer if this object is ordered before (after) the specified object, or zero if the two objects are considered have equal ordering
    • getCost

      public float getCost()
      Get the current accumulated cost.
      Returns:
      current accumulated cost
    • getDistance

      public float getDistance()
      Get the current accumulated distance.
      Returns:
      current accumulated distance
    • getKey

      public int getKey()
      Get the unique key identifier associated with this point.
      Returns:
      int Non-negative unique key identifier
    • getKeyPrev

      public int getKeyPrev()
      Get the unique key value for the point which is used to get to this point along the minimum cost path.
      Returns:
      Unique key value for this previous point, or KEY_UNDEFINED if point is not connected yet along the minimum cost path.
    • getNumPrev

      public int getNumPrev()
      Get the number of samples along the current minimum cost path that preceed this sample in the volume.
      Returns:
      non-negative integer for number of preceeding path samples along path. Should be zero for the starting point along the path.
    • isFinalized

      public boolean isFinalized()
      Test whether or not the sample has had its cost finalized.
      Returns:
      true if the cost for this sample has been finalized
    • markFinalized

      public void markFinalized()
      Mark the sample as having its cost finalized, meaning that it can no longer be updated.
    • markStart

      public void markStart()
      Mark this sample as the beginning of the minimum cost path.
    • update

      public void update(float fCost, float fDistance, int iKeyPrev, int iNumPrev)
      Mark this node as being visited along the minimum cost path if not already done so, but only if the point has not been marked as having its distance finalized. Update the accumulated distance for this sample including an indication of the point from which to get to this sample along the current minimum cost path.
      Parameters:
      fCost - accumulated cost to update for this sample; must not be negative
      fDistance - accumulated distance to update for this sample; must not be negative.
      iKeyPrev - Unique key value for the point which is used to get to this point along the minimum cost path.
      iNumPrev - number of samples along the minimum cost path leading up to this sample. Should be one more than the same field value for the point having key value iKeyPrev, if there is such a previous point.