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 iterations
previousVerdicts - 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 Details

    • JudgeContext

      public JudgeContext(int iteration, int maxIterations, List<JudgeVerdict> previousVerdicts, Duration timeBudget)
      Creates an instance of a JudgeContext record class.
      Parameters:
      iteration - the value for the iteration record component
      maxIterations - the value for the maxIterations record component
      previousVerdicts - the value for the previousVerdicts record component
      timeBudget - the value for the timeBudget record component
  • Method Details

    • isFinalIteration

      public boolean isFinalIteration()
      Whether this is the final allowed iteration.
    • first

      public static JudgeContext first(int maxIterations)
      Creates a context for the first iteration.
    • next

      public JudgeContext next(JudgeVerdict verdict)
      Creates the next iteration context by appending the given verdict.
    • 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 '=='.
      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.
    • iteration

      public int iteration()
      Returns the value of the iteration record component.
      Returns:
      the value of the iteration record component
    • maxIterations

      public int maxIterations()
      Returns the value of the maxIterations record component.
      Returns:
      the value of the maxIterations record component
    • previousVerdicts

      public List<JudgeVerdict> previousVerdicts()
      Returns the value of the previousVerdicts record component.
      Returns:
      the value of the previousVerdicts record component
    • timeBudget

      public Duration timeBudget()
      Returns the value of the timeBudget record component.
      Returns:
      the value of the timeBudget record component