summaryrefslogtreecommitdiff
path: root/src/bundles.adb
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-02-13 13:21:17 +1100
committerJed Barber <jjbarber@y7mail.com>2017-02-13 13:21:17 +1100
commitea99441e0da927e5a40cf21311265c7e22974f12 (patch)
treef824f30ab5f475f0f9b5e8a619a36dc81ea83284 /src/bundles.adb
parent835c2dffc539e277812925469c82662482e1bbc5 (diff)
Preference dedupe removed, bignum library obtained from internet (will be replaced later)
Diffstat (limited to 'src/bundles.adb')
-rw-r--r--src/bundles.adb28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/bundles.adb b/src/bundles.adb
index 50741ee..39c6cfa 100644
--- a/src/bundles.adb
+++ b/src/bundles.adb
@@ -5,17 +5,9 @@ package body Bundles is
procedure Add
(To : in out Bundle;
- Item : in Given_Prefs.Preference_Array)
- is
- use type Given_Prefs.Preference_Array;
+ Item : in Given_Prefs.Preference_Array) is
begin
- for P of To.Papers loop
- if P.Prefs = Item then
- P.How_Many := P.How_Many + 1;
- return;
- end if;
- end loop;
- To.Papers.Append ( (How_Many => 1, Prefs => Item) );
+ To.Papers.Append (Item);
end Add;
@@ -38,20 +30,21 @@ package body Bundles is
Position := Given_Prefs.Preference_Range'First;
while Position <= Given_Prefs.Preference_Range'Last and then
- P.Prefs (Position) /= From
+ P (Position) /= From
loop
Position := Position + 1;
end loop;
Position := Position + 1;
while Position <= Given_Prefs.Preference_Range'Last and then
- Excluded.Contains (P.Prefs (Position))
+ P (Position) /= Candidates.No_Candidate and then
+ Excluded.Contains (P (Position))
loop
Position := Position + 1;
end loop;
if Position <= Given_Prefs.Preference_Range'Last and then
- P.Prefs (Position) = To
+ P (Position) = To
then
Result.Papers.Append (P);
end if;
@@ -73,14 +66,9 @@ package body Bundles is
function Count_Papers
(This : in Bundle)
- return Natural
- is
- Result : Natural := 0;
+ return Natural is
begin
- for P of This.Papers loop
- Result := Result + P.How_Many;
- end loop;
- return Result;
+ return Integer (This.Papers.Length);
end Count_Papers;