summaryrefslogtreecommitdiff
path: root/src/preferences.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/preferences.ads
parent964a28e91593c4bf1e1c132536828d87f8d12c84 (diff)
Preference data reads into Bundles properly, with packed memory and a few fixed bugs
Diffstat (limited to 'src/preferences.ads')
-rw-r--r--src/preferences.ads33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/preferences.ads b/src/preferences.ads
index 7913019..d13b0c9 100644
--- a/src/preferences.ads
+++ b/src/preferences.ads
@@ -1,23 +1,48 @@
-with Candidates;
+with Candidates.Containers;
+private with Ada.Containers;
generic
- Number_Of_Candidates : Positive;
+ Pref_Size : Positive;
+ Above_Ballot : Candidates.Containers.Above_Line_Ballot;
+ Below_Ballot : Candidates.Containers.Below_Line_Ballot;
package Preferences is
- subtype Preference_Range is range 1 .. Number_Of_Candidates;
+ subtype Preference_Range is Positive range 1 .. Pref_Size;
- type Preference_Array is array Preference_Range
+ type Preference_Array is array (Preference_Range)
of Candidates.Extended_CandidateID;
+ pragma Pack (Preference_Array);
+
+
+ Empty_Array : constant Preference_Array :=
+ (others => Candidates.No_Candidate);
+
+
+ function Parse_Preferences
+ (Input : in String)
+ return Preference_Array;
private
+ Min_Above_Line : constant Positive := 1;
+ Min_Below_Line : constant Positive := 6;
+
+
+ subtype Above_Range is Ada.Containers.Count_Type range 1 .. Above_Ballot.Length;
+ type Above_Pref_Array is array (Above_Range) of Natural;
+
+
+ subtype Below_Range is Ada.Containers.Count_Type range 1 .. Below_Ballot.Length;
+ type Below_Pref_Array is array (Below_Range) of Natural;
+
+
end Preferences;