Class Election

java.lang.Object
org.episteme.social.sociology.Situation
org.episteme.social.politics.Election
All Implemented Interfaces:
Serializable, Commented, ComprehensiveIdentification, Identified<Identification>, Named, Positioned<Place>, Temporal<TimeCoordinate>

public class Election extends Situation implements Temporal<TimeCoordinate>
Represents a political election event, aggregating votes for candidates. An Election is a specific social Situation where Individuals assume Candidate roles. * @version 2.0
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Constructor Details

    • Election

      public Election(String title, Country country, LocalDate date)
      Creates a new Election.
      Parameters:
      title - the name of the election
      country - the country where it is held
      date - the date of the election
      Throws:
      NullPointerException - if any argument is null
  • Method Details

    • addBallot

      public void addBallot(Ballot ballot)
      Registers a cast ballot in this election.
      Parameters:
      ballot - the ballot to add
    • getBallots

      public List<Ballot> getBallots()
      Returns the list of all individual cast ballots.
      Returns:
      unmodifiable list of ballots
    • addCandidate

      public Candidate addCandidate(Individual individual, String office)
      Registers an individual as a candidate in this election.
      Parameters:
      individual - the person running
      office - the office sought
      Returns:
      the created Candidate role
    • addVoter

      public Voter addVoter(Individual individual)
      Registers an individual as a voter in this election.
      Parameters:
      individual - the person who will vote
      Returns:
      the created Voter role
    • calculateWinners

      public List<String> calculateWinners(VotingMethod method, int seats)
      Determines the winner(s) using a specific method and all cast ballots.
      Parameters:
      method - the voting system algorithm to use
      seats - number of seats to fill
      Returns:
      list of winners
    • addVote

      public void addVote(String candidateName, int count)
      Adds votes to a specific candidate or party name.
      Parameters:
      candidateName - name of candidate or party
      count - number of votes to add
    • getResults

      public Map<String,Integer> getResults()
      Returns the current tally of aggregated results.
      Returns:
      unmodifiable map of results
    • getWinner

      public String getWinner()
      Determines the winner based on the highest vote count (First Past The Post).
      Returns:
      the name of the winner (top aggregated), or null if no votes
    • getWhen

      public TimeCoordinate getWhen()
      Description copied from interface: Temporal
      Returns the temporal position (when) of this entity.
      Specified by:
      getWhen in interface Temporal<TimeCoordinate>
      Returns:
      the temporal position.
    • getDate

      public LocalDate getDate()
    • getCountry

      public Country getCountry()