Package com.tnsai.coordination.decision
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 decidedwinner- The winning option, or null if no consensusvoteCounts- Votes per optionconsensusReached- Whether consensus was achievedleaderOverride- Whether the leader made the final call (timeout fallback)method- Consensus algorithm usedtotalVotes- Total votes casttimestamp- 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 Summary
ConstructorsConstructorDescriptionDecisionResult(String decisionId, String topic, String winner, Map<String, Integer> voteCounts, boolean consensusReached, boolean leaderOverride, VotingMethod method, int totalVotes, Instant timestamp) Creates an instance of aDecisionResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theconsensusReachedrecord component.Returns the value of thedecisionIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns true if a winner was determined.booleanReturns the value of theleaderOverriderecord component.method()Returns the value of themethodrecord component.summary()Returns a summary string suitable for broadcasting to agents.Returns the value of thetimestamprecord component.topic()Returns the value of thetopicrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalVotesrecord component.Returns the value of thevoteCountsrecord component.winner()Returns the value of thewinnerrecord component.
-
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 aDecisionResultrecord class.- Parameters:
decisionId- the value for thedecisionIdrecord componenttopic- the value for thetopicrecord componentwinner- the value for thewinnerrecord componentvoteCounts- the value for thevoteCountsrecord componentconsensusReached- the value for theconsensusReachedrecord componentleaderOverride- the value for theleaderOverriderecord componentmethod- the value for themethodrecord componenttotalVotes- the value for thetotalVotesrecord componenttimestamp- the value for thetimestamprecord component
-
-
Method Details
-
hasWinner
public boolean hasWinner()Returns true if a winner was determined. -
summary
Returns a summary string suitable for broadcasting to agents. -
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 '=='. -
decisionId
Returns the value of thedecisionIdrecord component.- Returns:
- the value of the
decisionIdrecord component
-
topic
Returns the value of thetopicrecord component.- Returns:
- the value of the
topicrecord component
-
winner
Returns the value of thewinnerrecord component.- Returns:
- the value of the
winnerrecord component
-
voteCounts
Returns the value of thevoteCountsrecord component.- Returns:
- the value of the
voteCountsrecord component
-
consensusReached
public boolean consensusReached()Returns the value of theconsensusReachedrecord component.- Returns:
- the value of the
consensusReachedrecord component
-
leaderOverride
public boolean leaderOverride()Returns the value of theleaderOverriderecord component.- Returns:
- the value of the
leaderOverriderecord component
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
totalVotes
public int totalVotes()Returns the value of thetotalVotesrecord component.- Returns:
- the value of the
totalVotesrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-