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>
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters a cast ballot in this election.addCandidate(Individual individual, String office) Registers an individual as a candidate in this election.voidAdds votes to a specific candidate or party name.addVoter(Individual individual) Registers an individual as a voter in this election.calculateWinners(VotingMethod method, int seats) Determines the winner(s) using a specific method and all cast ballots.Returns the list of all individual cast ballots.getDate()Returns the current tally of aggregated results.getWhen()Returns the temporal position (when) of this entity.Determines the winner based on the highest vote count (First Past The Post).Methods inherited from class Situation
addParticipant, addParticipant, addRole, equals, getId, getIdentification, getPosition, getRoles, getTraits, hashCode, removeParticipant, setPosition, toStringMethods inherited from interface Commented
getComments, getTrait, setCommentsMethods inherited from interface ComprehensiveIdentification
getName, getTrait, setName, setTrait
-
Constructor Details
-
Election
Creates a new Election.- Parameters:
title- the name of the electioncountry- the country where it is helddate- the date of the election- Throws:
NullPointerException- if any argument is null
-
-
Method Details
-
addBallot
Registers a cast ballot in this election.- Parameters:
ballot- the ballot to add
-
getBallots
-
addCandidate
Registers an individual as a candidate in this election.- Parameters:
individual- the person runningoffice- the office sought- Returns:
- the created Candidate role
-
addVoter
Registers an individual as a voter in this election.- Parameters:
individual- the person who will vote- Returns:
- the created Voter role
-
calculateWinners
Determines the winner(s) using a specific method and all cast ballots.- Parameters:
method- the voting system algorithm to useseats- number of seats to fill- Returns:
- list of winners
-
addVote
Adds votes to a specific candidate or party name.- Parameters:
candidateName- name of candidate or partycount- number of votes to add
-
getResults
-
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
Description copied from interface:TemporalReturns the temporal position (when) of this entity.- Specified by:
getWhenin interfaceTemporal<TimeCoordinate>- Returns:
- the temporal position.
-
getDate
-
getCountry
-