summaryrefslogtreecommitdiff
path: root/src/candidates.ads
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-02-05 00:43:59 +1100
committerJed Barber <jjbarber@y7mail.com>2017-02-05 00:43:59 +1100
commit5a8a3749f46828f1db5cbd6bd55d22ea9e188ab1 (patch)
tree165e0c87d3cfaa2cc4565f7d8ea84fe6445b5657 /src/candidates.ads
parent464156f1baa38b6c6bd95b1d4d4e9f7c05e4294e (diff)
CSV package done, sketched out Candidates package
Diffstat (limited to 'src/candidates.ads')
-rw-r--r--src/candidates.ads75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/candidates.ads b/src/candidates.ads
new file mode 100644
index 0000000..90b2425
--- /dev/null
+++ b/src/candidates.ads
@@ -0,0 +1,75 @@
+
+
+with Ada.Containers.Vectors;
+
+
+package Candidates is
+
+
+ type Candidate is private;
+ type CandidateID is Natural;
+
+
+ type Above_Line_Ballot is private;
+ type Below_Line_Ballot is private;
+
+
+ package Candidate_Vectors is new Ada.Containers.Vectors
+ (Index_Type => CandidateID,
+ Element_Type => Candidate);
+
+
+ package CandidateID_Vectors is new Ada.Containers.Vectors
+ (Index_Type => Natural,
+ Element_Type => CandidateID);
+
+
+ procedure Read_Candidates
+ (Data_File, State : in String;
+ Above_Ballot : out Above_Line_Ballot;
+ Below_Ballot : out Below_Line_Ballot;
+ Candidate_List : out Candidate_Vectors.Vector);
+
+
+ function Lookup
+ (Above_Ballot : in Above_Line_Ballot;
+ Index : in Natural)
+ return CandidateID_Vectors.Vector;
+
+
+ function Lookup
+ (Below_Ballot : in Below_Line_Ballot;
+ Index : in Natural)
+ return CandidateID;
+
+
+private
+
+
+ type Candidate is record
+ ID : CandidateID;
+ First_Name : String;
+ Last_Name : String;
+ Group : String;
+ Group_Rank : Natural;
+ Party : String;
+ end record;
+
+
+ package Above_Line_Ballots is new Ada.Containers.Vectors
+ (Index_Type => Natural,
+ Element_Type => CandidateID_Vectors.Vector);
+
+
+ package Below_Line_Ballots is new Ada.Containers.Vectors
+ (Index_Type => Natural,
+ Element_Type => CandidateID);
+
+
+ type Above_Line_Ballot is Above_Line_Ballots.Vector;
+ type Below_Line_Ballot is Below_Line_Ballots.Vector;
+
+
+end Candidates;
+
+