summaryrefslogtreecommitdiff
path: root/src/election.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/election.adb')
-rw-r--r--src/election.adb20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/election.adb b/src/election.adb
index c7de32b..7e825b3 100644
--- a/src/election.adb
+++ b/src/election.adb
@@ -22,12 +22,6 @@ package body Election is
package SU renames Ada.Strings.Unbounded;
- -- These make converting back and forth easier.
- -- Why are they distinct types? Because you can't pass a subtype to a generic.
- subtype CanID is Candidates.CandidateID;
- subtype CID_Range is Bundle_Containers.Candidate_Range;
-
-
-- Candidate, preference data, and other information
@@ -79,11 +73,11 @@ package body Election is
This : Entry_Data;
begin
Entries := Entry_Vectors.Empty_Vector;
- for CID in Bundle_Containers.Candidate_Range loop
+ for CID in Bundle_Containers.Valid_CandidateID loop
Given_Bundles.Count_Both
(Pref_Data (CID).First_Element, Votes, Papers);
This :=
- (ID => CanID (CID),
+ (ID => CID,
Vote_Change => Votes,
Total_Votes => Votes,
Paper_Change => Papers,
@@ -421,7 +415,7 @@ package body Election is
Given_Bundles.Count_Both (New_Bundle, Votes_In, Papers_In);
if Votes_In > 0 then
- Pref_Data (CID_Range (Working_ID)).Append (New_Bundle);
+ Pref_Data (Working_ID).Append (New_Bundle);
declare
Entry_Ref : Entry_Vectors.Reference_Type :=
Entries.Reference (Working_Position);
@@ -463,22 +457,22 @@ package body Election is
This_Transfer := Transfers.First_Element;
- while Pref_Data (CID_Range (This_Transfer.From)).Length > 0 loop
+ while Pref_Data (This_Transfer.From).Length > 0 loop
Redistribute_Papers
(Still_Running => Running_Positions,
Already_Excluded => Not_Considered,
- Transfer_Bundle => Pref_Data (CID_Range (This_Transfer.From)).Reference (1),
+ Transfer_Bundle => Pref_Data (This_Transfer.From).Reference (1),
Transfer => This_Transfer,
Fractional_Loss => Fractional_Loss,
Exhausted_Loss => Exhausted_Loss);
- Pref_Data (CID_Range (This_Transfer.From)).Delete (1);
+ Pref_Data (This_Transfer.From).Delete (1);
Fractional.Paper_Change := Fractional.Paper_Change + Fractional_Loss;
Exhausted.Paper_Change := Exhausted.Paper_Change + Exhausted_Loss;
end loop;
- if Pref_Data (CID_Range (This_Transfer.From)).Length = 0 then
+ if Pref_Data (This_Transfer.From).Length = 0 then
declare
Entry_Ref : Entry_Vectors.Reference_Type :=
Entries.Reference (This_Transfer.Position);