Record Class GerrymanderingDetector.District
java.lang.Object
java.lang.Record
org.episteme.social.politics.GerrymanderingDetector.District
- All Implemented Interfaces:
Serializable
- Enclosing class:
GerrymanderingDetector
public static record GerrymanderingDetector.District(String id, int totalVoters, int partyAVotes, int partyBVotes, double compactnessScore, List<double[]> boundary)
extends Record
implements Serializable
Data model for an individual electoral district.
- Since:
- 1.0
- Version:
- 1.1
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<double[]> boundary()Returns the value of theboundaryrecord component.doubleReturns the value of thecompactnessScorerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.intReturns the value of thepartyAVotesrecord component.intReturns the value of thepartyBVotesrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalVotersrecord component.
-
Constructor Details
-
District
public District(String id, int totalVoters, int partyAVotes, int partyBVotes, double compactnessScore, List<double[]> boundary) Creates an instance of aDistrictrecord class.- Parameters:
id- the value for theidrecord componenttotalVoters- the value for thetotalVotersrecord componentpartyAVotes- the value for thepartyAVotesrecord componentpartyBVotes- the value for thepartyBVotesrecord componentcompactnessScore- the value for thecompactnessScorerecord componentboundary- the value for theboundaryrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
totalVoters
public int totalVoters()Returns the value of thetotalVotersrecord component.- Returns:
- the value of the
totalVotersrecord component
-
partyAVotes
public int partyAVotes()Returns the value of thepartyAVotesrecord component.- Returns:
- the value of the
partyAVotesrecord component
-
partyBVotes
public int partyBVotes()Returns the value of thepartyBVotesrecord component.- Returns:
- the value of the
partyBVotesrecord component
-
compactnessScore
public double compactnessScore()Returns the value of thecompactnessScorerecord component.- Returns:
- the value of the
compactnessScorerecord component
-
boundary
Returns the value of theboundaryrecord component.- Returns:
- the value of the
boundaryrecord component
-