Record Class AStarUtil.PathResult<V>

java.lang.Object
java.lang.Record
cloud.opencode.base.graph.algorithm.AStarUtil.PathResult<V>
Type Parameters:
V - the vertex type | 顶点类型
Record Components:
path - the path vertices | 路径顶点
cost - the total path cost | 总路径成本
nodesExpanded - number of nodes expanded during search | 搜索期间展开的节点数
Enclosing class:
AStarUtil

public static record AStarUtil.PathResult<V>(List<V> path, double cost, int nodesExpanded) extends Record
Result of A* search including path and cost A*搜索结果,包含路径和成本
Since:
JDK 25, opencode-base-graph V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Summary

    Constructors
    Constructor
    Description
    PathResult(List<V> path, double cost, int nodesExpanded)
    Creates an instance of a PathResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the value of the cost record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
     
    int
    Returns the value of the nodesExpanded record component.
    Returns the value of the path record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • PathResult

      public PathResult(List<V> path, double cost, int nodesExpanded)
      Creates an instance of a PathResult record class.
      Parameters:
      path - the value for the path record component
      cost - the value for the cost record component
      nodesExpanded - the value for the nodesExpanded record component
  • Method Details

    • hasPath

      public boolean hasPath()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • path

      public List<V> path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • cost

      public double cost()
      Returns the value of the cost record component.
      Returns:
      the value of the cost record component
    • nodesExpanded

      public int nodesExpanded()
      Returns the value of the nodesExpanded record component.
      Returns:
      the value of the nodesExpanded record component