summaryrefslogtreecommitdiff
path: root/src/election.ads
diff options
context:
space:
mode:
Diffstat (limited to 'src/election.ads')
-rw-r--r--src/election.ads75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/election.ads b/src/election.ads
new file mode 100644
index 0000000..365ff35
--- /dev/null
+++ b/src/election.ads
@@ -0,0 +1,75 @@
+
+
+with Candidates.Containers;
+with Bundles.Containers;
+private with Ada.Containers.Vectors;
+
+
+generic
+ with package Given_Bundles is new Bundles (<>);
+ with package Bundle_Containers is new Given_Bundles.Containers (<>);
+package Election is
+
+
+ procedure Setup
+ (Candidate_Data : in Candidates.Containers.Candidate_Map;
+ Preference_File : in String;
+ Output_Dir, Main_Logfile : in String;
+ Number_To_Elect : in Natural;
+ Is_Verbose : in Boolean := False)
+ with Post => Is_Properly_Setup;
+
+
+ procedure Run
+ with Pre => Is_Properly_Setup;
+
+
+ function Is_Properly_Setup
+ return Boolean;
+
+
+private
+
+
+ type Candidate_Status is (Elected, Running, Excluded);
+
+
+ type Entry_Data is record
+ ID : Candidates.CandidateID;
+ Vote_Change : Integer;
+ Total_Votes : Natural;
+ Paper_Change : Integer;
+ Total_Papers : Natural;
+ Status : Candidate_Status;
+ Changed : Boolean;
+ Order_Elected : Natural;
+ end record;
+
+
+ package Entry_Vectors is new Ada.Containers.Vectors
+ (Index_Type => Positive,
+ Element_Type => Entry_Data);
+
+
+ type Pending_Transfer is record
+ From : Candidates.CandidateID;
+ Position : Positive;
+ end record;
+
+
+ package Transfer_Vectors is new Ada.Containers.Vectors
+ (Index_Type => Positive,
+ Element_Type => Pending_Transfer);
+
+
+ -- this is used to keep track of exhausted and
+ -- fractional loss votes/papers
+ type Extra_Data is record
+ Paper_Change : Integer;
+ Total_Papers : Natural;
+ end record;
+
+
+end Election;
+
+