Class Ballot
java.lang.Object
org.episteme.social.politics.Ballot
- All Implemented Interfaces:
Serializable
Represents a cast ballot in an election, supporting various voting methods.
A ballot can capture multiple decision points (e.g., President, Governor),
and for each, it supports single choices, ranked lists of preferences, or ratings.
Integrated with the persistence system and uses Real for internal scores.
- Since:
- 1.0
- Version:
- 2.1
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTopChoice(String electionId) Retrieves the top choice for a given election.static BallotrankedChoice(String voterId, String electionId, List<String> rankings) Creates a ranked-choice ballot for a specific election.static BallotCreates a cardinal/rating ballot for a specific election from double values.ratings()static BallotsingleChoice(String voterId, String electionId, String choice) Creates a simple single-choice ballot for a specific election.toString()voterId()
-
Constructor Details
-
Ballot
-
-
Method Details
-
singleChoice
Creates a simple single-choice ballot for a specific election.- Parameters:
voterId- Identifier of the voterelectionId- The decision point ID (e.g., "PRESIDENT_2026")choice- The selected candidate or choice- Returns:
- A new Ballot instance
-
rankedChoice
Creates a ranked-choice ballot for a specific election.- Parameters:
voterId- Identifier of the voterelectionId- The decision point IDrankings- Ordered list of candidates (index 0 is top preference)- Returns:
- A new Ballot instance
-
ratedChoice
Creates a cardinal/rating ballot for a specific election from double values.- Parameters:
voterId- Identifier of the voterelectionId- The decision point IDscores- Map of Candidate -> Score (double)- Returns:
- A new Ballot instance
-
voterId
-
selections
-
ratings
-
getTopChoice
-
toString
-