From 8a7c0dd18cb373a5b3c69e13f110562e156575e9 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 7 Feb 2017 00:22:13 +1100 Subject: Started to sketch out Bundles package --- src/bundles.adb | 8 ++++++++ src/bundles.ads | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/bundles.adb create mode 100644 src/bundles.ads diff --git a/src/bundles.adb b/src/bundles.adb new file mode 100644 index 0000000..6a2d71d --- /dev/null +++ b/src/bundles.adb @@ -0,0 +1,8 @@ + + +package body Bundles is + + +end Bundles; + + diff --git a/src/bundles.ads b/src/bundles.ads new file mode 100644 index 0000000..aa0b0d6 --- /dev/null +++ b/src/bundles.ads @@ -0,0 +1,53 @@ + + +with Candidates; +with Rationals; +private with Ada.Containers.Vectors; + + +generic + Number_Of_Candidates : Positive; +package Bundles is + + + type Bundle is private; + subtype Preference_Array is array (1 .. Number_Of_Candidates) of Candidates.CandidateID; + + + Empty_Bundle : constant Bundle; + + + procedure Add + (To : in out Bundle; + Item : in Preference_Array); + + + procedure Transfer + (From, To : in out Bundle; + Value : in Rationals.Fraction); + + + function Count + (This : in Bundle) + return Natural; + + +private + + + type Paper_Lot is record + How_Many : Positive := 1; + Prefs : Preference_Array; + end record; + + + type Bundle is record + + + + Empty_Bundle := + + +end Bundles; + + -- cgit