summaryrefslogtreecommitdiff
path: root/src/candidates.ads
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-02-10 18:41:36 +1100
committerJed Barber <jjbarber@y7mail.com>2017-02-10 18:41:36 +1100
commit60b2207a469a5a1e7a7e5619a8eb1b01c67f314a (patch)
treec928299d78242f2b36798e8c1802914552626352 /src/candidates.ads
parent964a28e91593c4bf1e1c132536828d87f8d12c84 (diff)
Preference data reads into Bundles properly, with packed memory and a few fixed bugs
Diffstat (limited to 'src/candidates.ads')
-rw-r--r--src/candidates.ads123
1 files changed, 4 insertions, 119 deletions
diff --git a/src/candidates.ads b/src/candidates.ads
index fe25228..fef8d4c 100644
--- a/src/candidates.ads
+++ b/src/candidates.ads
@@ -1,7 +1,6 @@
private with Ada.Strings.Unbounded;
-private with Ada.Containers.Vectors;
package Candidates is
@@ -11,7 +10,10 @@ package Candidates is
type Candidate is private;
- type CandidateID is new Positive;
+
+
+ -- this is restricted to 255 values for memory conservation reasons
+ type CandidateID is new Positive range 1 .. 255;
subtype Extended_CandidateID is CandidateID'Base
@@ -27,94 +29,6 @@ package Candidates is
return String;
-
-
- type Candidate_Vector is private;
- type CandidateID_Vector is private;
-
-
- procedure Read_Candidates
- (Filename : in String;
- State : in State_Name;
- Candidate_List : out Candidate_Vector);
-
-
- function First
- (Candidate_List : in Candidate_Vector)
- return CandidateID;
-
-
- function Last
- (Candidate_List : in Candidate_Vector)
- return CandidateID;
-
-
- function Lookup
- (Candidate_List : in Candidate_Vector;
- Index : in CandidateID)
- return Candidate;
-
-
- function First
- (CandidateID_List : in CandidateID_Vector)
- return Positive;
-
-
- function Last
- (CandidateID_List : in CandidateID_Vector)
- return Positive;
-
-
- function Lookup
- (CandidateID_List : in CandidateID_Vector;
- Index : in Positive)
- return CandidateID;
-
-
-
-
- type Above_Line_Ballot is private;
- type Below_Line_Ballot is private;
-
-
- procedure Generate_Ballots
- (Candidate_List : in Candidate_Vector;
- Above_Ballot : out Above_Line_Ballot;
- Below_Ballot : out Below_Line_Ballot);
-
-
- function First
- (Above_Ballot : in Above_Line_Ballot)
- return Positive;
-
-
- function Last
- (Above_Ballot : in Above_Line_Ballot)
- return Positive;
-
-
- function Lookup
- (Above_Ballot : in Above_Line_Ballot;
- Index : in Positive)
- return CandidateID_Vector;
-
-
- function First
- (Below_Ballot : in Below_Line_Ballot)
- return Positive;
-
-
- function Last
- (Below_Ballot : in Below_Line_Ballot)
- return Positive;
-
-
- function Lookup
- (Below_Ballot : in Below_Line_Ballot;
- Index : in Positive)
- return CandidateID;
-
-
private
@@ -130,35 +44,6 @@ private
end record;
- package Candidate_Vectors is new Ada.Containers.Vectors
- (Index_Type => CandidateID,
- Element_Type => Candidate);
- type Candidate_Vector is record
- Vec : Candidate_Vectors.Vector;
- end record;
-
-
- package CandidateID_Vectors is new Ada.Containers.Vectors
- (Index_Type => Positive,
- Element_Type => CandidateID);
- type CandidateID_Vector is record
- Vec : CandidateID_Vectors.Vector;
- end record;
-
-
- package Above_Line_Ballots is new Ada.Containers.Vectors
- (Index_Type => Positive,
- Element_Type => CandidateID_Vector);
- type Above_Line_Ballot is record
- Vec : Above_Line_Ballots.Vector;
- end record;
-
-
- type Below_Line_Ballot is record
- Vec : CandidateID_Vectors.Vector;
- end record;
-
-
end Candidates;