Interface VoterAllocation

All Superinterfaces:
Browsable, Extensible, Identifiable, OsidObject

public interface VoterAllocation extends OsidObject

An allocation of votes for an individual resource or a resource group.

  • Method Details

    • getRaceId

      Id getRaceId()
      Gets the race Id of the vote.
      Returns:
      the ballot Id
      Compliance:
      mandatory - This method must be implemented.
    • getRace

      Race getRace() throws OperationFailedException
      Gets the race of the vote.
      Returns:
      the race
      Throws:
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • getVoterId

      Id getVoterId()
      Gets the resource Id.
      Returns:
      a resource Id
      Compliance:
      mandatory - This method must be implemented.
    • getVoter

      Gets the Resource.
      Returns:
      the resource
      Throws:
      OperationFailedException - unable to complete request
      Compliance:
      mandatory - This method must be implemented.
    • getTotalVotes

      long getTotalVotes()
      Gets the total number of votes the resource can cast in this race.
      Returns:
      the number of votes
      Compliance:
      mandatory - This method must be implemented.
    • getMaxVotesPerCandidate

      long getMaxVotesPerCandidate()
      Gets the maximum votes per candidate the resource can cast in this race.
      Returns:
      the max votes per candidate
      Compliance:
      mandatory - This method must be implemented.
    • hasMaxCandidates

      boolean hasMaxCandidates()
      Tests if this resource can vote for a limited number of candidates.
      Returns:
      true if a limit on the number of candidates exists, false if no limit exists
      Compliance:
      mandatory - This method must be implemented.
    • getMaxCandidates

      long getMaxCandidates()
      Gets the maximum number of candidates for which this resource can vote.
      Returns:
      the maximum candidates
      Throws:
      IllegalStateException - hasMaxCandidates() is false
      Compliance:
      mandatory - This method must be implemented.
    • reallocatesVotesWhenCandidateDrops

      boolean reallocatesVotesWhenCandidateDrops()
      Tests if this resource gets the number of votes cast for a candidate when the candidate is no longer running in a race.
      Returns:
      true if votes are returned to the resource when the candidate drops from the race, false otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getVoterAllocationRecord

      VoterAllocationRecord getVoterAllocationRecord(Type voterAllocationRecordType) throws OperationFailedException
      Gets the voter allocation record corresponding to the given VoterAllocation record Type. This method is used to retrieve an object implementing the requested record. The voterAllocationRecordType may be the Type returned in getRecordTypes() or any of its parents in a Type hierarchy where hasRecordType(voterAllocationRecordType) is true .
      Parameters:
      voterAllocationRecordType - the type of the record to retrieve
      Returns:
      the voter allocation record
      Throws:
      NullArgumentException - voterAllocationRecordType is null
      OperationFailedException - unable to complete request
      UnsupportedException - hasRecordType(voterAllocationRecordType) is false
      Compliance:
      mandatory - This method must be implemented.