summaryrefslogtreecommitdiff
path: root/src/preferences.ads
blob: 4f0700d5d2b3bda9da4dea0ac8f90c573b5a4b93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56


with Candidates.Containers;
private with Ada.Containers;


--  This source is licensed under Creative Commons CC0 v1.0.
--
--  To read the full text, see license.txt in the main directory of this repository
--  or go to https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt
--
--  For a human readable summary, go to https://creativecommons.org/publicdomain/zero/1.0/


generic
    Pref_Size    : Positive;
    Above_Ballot : Candidates.Containers.Above_Line_Ballot;
    Below_Ballot : Candidates.Containers.Below_Line_Ballot;
package Preferences is


    subtype Preference_Range is Positive range 1 .. Pref_Size;


    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;