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

    Constructors
    Constructor
    Description
    VoteResult(int approvals, int rejections, int abstentions, Set<String> voters)
    Creates an instance of a VoteResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the abstentions record component.
    double
     
    int
    Returns the value of the approvals record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    isPassing(double threshold)
     
    int
    Returns the value of the rejections record component.
    Returns a string representation of this record class.
    int
     
    Returns the value of the voters record component.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • VoteResult

      public VoteResult(int approvals, int rejections, int abstentions, Set<String> voters)
      Creates an instance of a VoteResult record class.
      Parameters:
      approvals - the value for the approvals record component
      rejections - the value for the rejections record component
      abstentions - the value for the abstentions record component
      voters - the value for the voters record component
  • Method Details

    • total

      public int total()
    • approvalRatio

      public double approvalRatio()
    • isPassing

      public boolean isPassing(double threshold)
    • toString

      public 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.
    • approvals

      public int approvals()
      Returns the value of the approvals record component.
      Returns:
      the value of the approvals record component
    • rejections

      public int rejections()
      Returns the value of the rejections record component.
      Returns:
      the value of the rejections record component
    • abstentions

      public int abstentions()
      Returns the value of the abstentions record component.
      Returns:
      the value of the abstentions record component
    • voters

      public Set<String> voters()
      Returns the value of the voters record component.
      Returns:
      the value of the voters record component