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 nodesecondbest- the second-best nodebestindex- the index of the best node in the input collectionbest2index- 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 -
Method Summary
Modifier and TypeMethodDescriptionbest()Returns the value of thebestrecord component.intReturns the value of thebest2indexrecord component.intReturns the value of thebestindexrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thesecondbestrecord component.booleanseparation(MetricKeeper... metrics) Separation occurs when one node in a set of children is strictly better than its siblings.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Result
Creates an instance of aResultrecord class.- Parameters:
best- the value for thebestrecord componentsecondbest- the value for thesecondbestrecord componentbestindex- the value for thebestindexrecord componentbest2index- the value for thebest2indexrecord component
-
-
Method Details
-
separation
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.Resultwas obtained throughGameTreeNode.mostOptimistic2(Collection, boolean, MetricKeeper...)- Parameters:
metrics-MetricKeeperobjects to notify of node evaluations made by this check- Returns:
trueif the sub-tree from the parent of the givenchildrencould be pruned according to the separation rule;falseotherwise.
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
best
-
secondbest
Returns the value of thesecondbestrecord component.- Returns:
- the value of the
secondbestrecord component
-
bestindex
-
best2index
public int best2index()Returns the value of thebest2indexrecord component.- Returns:
- the value of the
best2indexrecord component
-