Package com.tnsai.communication
Record Class SharedBlackboard.VoteResult
java.lang.Object
java.lang.Record
com.tnsai.communication.SharedBlackboard.VoteResult
- Enclosing class:
SharedBlackboard
public static record SharedBlackboard.VoteResult(int approvals, int rejections, int abstentions, Set<String> voters)
extends Record
Vote result record.
-
Constructor Summary
ConstructorsConstructorDescriptionVoteResult(int approvals, int rejections, int abstentions, Set<String> voters) Creates an instance of aVoteResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theabstentionsrecord component.doubleintReturns the value of theapprovalsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisPassing(double threshold) intReturns the value of therejectionsrecord component.toString()Returns a string representation of this record class.inttotal()voters()Returns the value of thevotersrecord component.
-
Constructor Details
-
VoteResult
Creates an instance of aVoteResultrecord class.- Parameters:
approvals- the value for theapprovalsrecord componentrejections- the value for therejectionsrecord componentabstentions- the value for theabstentionsrecord componentvoters- the value for thevotersrecord component
-
-
Method Details
-
total
public int total() -
approvalRatio
public double approvalRatio() -
isPassing
public boolean isPassing(double threshold) -
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 '=='. -
approvals
public int approvals()Returns the value of theapprovalsrecord component.- Returns:
- the value of the
approvalsrecord component
-
rejections
public int rejections()Returns the value of therejectionsrecord component.- Returns:
- the value of the
rejectionsrecord component
-
abstentions
public int abstentions()Returns the value of theabstentionsrecord component.- Returns:
- the value of the
abstentionsrecord component
-
voters
Returns the value of thevotersrecord component.- Returns:
- the value of the
votersrecord component
-