Record Class GameTreeNode.Result<N extends GameTreeNode<N,P>, P extends IGamePosition<P>>

java.lang.Object
java.lang.Record
gametree.GameTreeNode.Result<N,P>
Record Components:
best - the best node
secondbest - the second-best node
bestindex - the index of the best node in the input collection
best2index - the index of the second-best node in the input collection
Enclosing class:
GameTreeNode<N extends GameTreeNode<N,P>, P extends IGamePosition<P>>

public static record GameTreeNode.Result<N extends GameTreeNode<N,P>, P extends IGamePosition<P>>(N extends GameTreeNode<N,P> best, N extends GameTreeNode<N,P> secondbest, int bestindex, int best2index) extends Record
A record to hold the two best nodes (and their indices in the original collection).
Version:
1.0
Author:
Pascal Rodrigo Anema
  • Constructor Summary

    Constructors
    Constructor
    Description
    Result(N best, N secondbest, int bestindex, int best2index)
    Creates an instance of a Result record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the best record component.
    int
    Returns the value of the best2index record component.
    int
    Returns the value of the bestindex record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the secondbest record component.
    boolean
    Separation occurs when one node in a set of children is strictly better than its siblings.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • Result

      public Result(N best, N secondbest, int bestindex, int best2index)
      Creates an instance of a Result record class.
      Parameters:
      best - the value for the best record component
      secondbest - the value for the secondbest record component
      bestindex - the value for the bestindex record component
      best2index - the value for the best2index record component
  • Method Details

    • separation

      public boolean separation(MetricKeeper... metrics)
      Separation occurs when one node in a set of children is strictly better than its siblings. In this case, the remaining children can be discarded from the search. The best child is now the only relevant child among the set of children.

      Note that this only accurately checks for separation if this GameTreeNode.Result was obtained through GameTreeNode.mostOptimistic2(Collection, boolean, MetricKeeper...)

      Parameters:
      metrics - MetricKeeper objects to notify of node evaluations made by this check
      Returns:
      true if the sub-tree from the parent of the given children could be pruned according to the separation rule; false otherwise.
    • 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.
    • best

      public N best()
      Returns the value of the best record component.
      Returns:
      the value of the best record component
    • secondbest

      public N secondbest()
      Returns the value of the secondbest record component.
      Returns:
      the value of the secondbest record component
    • bestindex

      public int bestindex()
      Returns the value of the bestindex record component.
      Returns:
      the value of the bestindex record component
    • best2index

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