Record Class DecisionResult

java.lang.Object
java.lang.Record
com.tnsai.coordination.decision.DecisionResult
Record Components:
decisionId - Unique decision identifier (matches proposal ID)
topic - The question that was decided
winner - The winning option, or null if no consensus
voteCounts - Votes per option
consensusReached - Whether consensus was achieved
leaderOverride - Whether the leader made the final call (timeout fallback)
method - Consensus algorithm used
totalVotes - Total votes cast
timestamp - When the decision was finalized

public record DecisionResult(String decisionId, String topic, String winner, Map<String,Integer> voteCounts, boolean consensusReached, boolean leaderOverride, VotingMethod method, int totalVotes, Instant timestamp) extends Record
The outcome of a group decision process.
  • Constructor Details

    • DecisionResult

      public DecisionResult(String decisionId, String topic, String winner, Map<String,Integer> voteCounts, boolean consensusReached, boolean leaderOverride, VotingMethod method, int totalVotes, Instant timestamp)
      Creates an instance of a DecisionResult record class.
      Parameters:
      decisionId - the value for the decisionId record component
      topic - the value for the topic record component
      winner - the value for the winner record component
      voteCounts - the value for the voteCounts record component
      consensusReached - the value for the consensusReached record component
      leaderOverride - the value for the leaderOverride record component
      method - the value for the method record component
      totalVotes - the value for the totalVotes record component
      timestamp - the value for the timestamp record component
  • Method Details

    • hasWinner

      public boolean hasWinner()
      Returns true if a winner was determined.
    • summary

      public String summary()
      Returns a summary string suitable for broadcasting to agents.
    • 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.
    • decisionId

      public String decisionId()
      Returns the value of the decisionId record component.
      Returns:
      the value of the decisionId record component
    • topic

      public String topic()
      Returns the value of the topic record component.
      Returns:
      the value of the topic record component
    • winner

      public String winner()
      Returns the value of the winner record component.
      Returns:
      the value of the winner record component
    • voteCounts

      public Map<String,Integer> voteCounts()
      Returns the value of the voteCounts record component.
      Returns:
      the value of the voteCounts record component
    • consensusReached

      public boolean consensusReached()
      Returns the value of the consensusReached record component.
      Returns:
      the value of the consensusReached record component
    • leaderOverride

      public boolean leaderOverride()
      Returns the value of the leaderOverride record component.
      Returns:
      the value of the leaderOverride record component
    • method

      public VotingMethod method()
      Returns the value of the method record component.
      Returns:
      the value of the method record component
    • totalVotes

      public int totalVotes()
      Returns the value of the totalVotes record component.
      Returns:
      the value of the totalVotes record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component