summaryrefslogtreecommitdiff
path: root/src/bundles.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/bundles.ads
parent964a28e91593c4bf1e1c132536828d87f8d12c84 (diff)
Preference data reads into Bundles properly, with packed memory and a few fixed bugs
Diffstat (limited to 'src/bundles.ads')
-rw-r--r--src/bundles.ads35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/bundles.ads b/src/bundles.ads
index db6565d..a58a232 100644
--- a/src/bundles.ads
+++ b/src/bundles.ads
@@ -1,10 +1,9 @@
with Preferences;
-with Candidates;
+with Candidates.Containers;
with Rationals;
-with Ada.Containers.Ordered_Maps;
-with Ada.Containers.Vectors;
+private with Ada.Containers.Vectors;
generic
@@ -18,21 +17,6 @@ package Bundles is
Empty_Bundle : constant Bundle;
- package Bundle_Vectors is new Ada.Containers.Vectors with
- (Index_Type => Positive,
- Element_Type => Bundle);
-
-
- package Bundle_Maps is new Ada.Containers.Ordered_Maps
- (Key_Type => Candidates.CandidateID,
- Element_Type => Bundle_Vectors.Vector);
-
-
- procedure Read_Bundles
- (Filename : in String;
- Result : out Bundle_Maps.Map);
-
-
procedure Add
(To : in out Bundle;
Item : in Given_Prefs.Preference_Array);
@@ -41,7 +25,7 @@ package Bundles is
procedure Transfer
(This : in out Bundle;
From, To : in Candidates.CandidateID;
- Excluded : in Candidates.CandidateID_Vector;
+ Excluded : in Candidates.Containers.CandidateID_Set;
Value : in Rationals.Fraction;
Result : out Bundle);
@@ -56,6 +40,11 @@ package Bundles is
return Natural;
+ function "<"
+ (Left, Right : in Bundle)
+ return Boolean;
+
+
private
@@ -73,12 +62,20 @@ private
Element_Type => Paper_Lot);
+ use type Paper_Vectors.Vector;
+
+
type Bundle is record
Papers : Paper_Vectors.Vector := Paper_Vectors.Empty_Vector;
Worth : Rationals.Fraction := 1 / 1;
end record;
+ Empty_Bundle : constant Bundle :=
+ (Papers => Paper_Vectors.Empty_Vector,
+ Worth => 1 / 1);
+
+
end Bundles;