Package com.tnsai.coordination.judge
Record Class JudgeContext
java.lang.Object
java.lang.Record
com.tnsai.coordination.judge.JudgeContext
- Record Components:
iteration- current iteration number (1-based)maxIterations- maximum allowed iterationspreviousVerdicts- verdicts from prior iterations (empty on first)timeBudget- optional remaining time budget (null if unbounded)
public record JudgeContext(int iteration, int maxIterations, List<JudgeVerdict> previousVerdicts, Duration timeBudget)
extends Record
Context passed to a
JudgePolicy during evaluation.
Provides iteration state, history of previous verdicts, and time budget so policies can make informed decisions (e.g. relax standards on final retry).
- Since:
- 0.2.3
-
Constructor Summary
ConstructorsConstructorDescriptionJudgeContext(int iteration, int maxIterations, List<JudgeVerdict> previousVerdicts, Duration timeBudget) Creates an instance of aJudgeContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static JudgeContextfirst(int maxIterations) Creates a context for the first iteration.final inthashCode()Returns a hash code value for this object.booleanWhether this is the final allowed iteration.intReturns the value of theiterationrecord component.intReturns the value of themaxIterationsrecord component.next(JudgeVerdict verdict) Creates the next iteration context by appending the given verdict.Returns the value of thepreviousVerdictsrecord component.Returns the value of thetimeBudgetrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
JudgeContext
public JudgeContext(int iteration, int maxIterations, List<JudgeVerdict> previousVerdicts, Duration timeBudget) Creates an instance of aJudgeContextrecord class.- Parameters:
iteration- the value for theiterationrecord componentmaxIterations- the value for themaxIterationsrecord componentpreviousVerdicts- the value for thepreviousVerdictsrecord componenttimeBudget- the value for thetimeBudgetrecord component
-
-
Method Details
-
isFinalIteration
public boolean isFinalIteration()Whether this is the final allowed iteration. -
first
Creates a context for the first iteration. -
next
Creates the next iteration context by appending the given verdict. -
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. -
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. -
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 '=='. -
iteration
public int iteration()Returns the value of theiterationrecord component.- Returns:
- the value of the
iterationrecord component
-
maxIterations
public int maxIterations()Returns the value of themaxIterationsrecord component.- Returns:
- the value of the
maxIterationsrecord component
-
previousVerdicts
Returns the value of thepreviousVerdictsrecord component.- Returns:
- the value of the
previousVerdictsrecord component
-
timeBudget
Returns the value of thetimeBudgetrecord component.- Returns:
- the value of the
timeBudgetrecord component
-