summaryrefslogtreecommitdiff
path: root/src/bundles.adb
diff options
context:
space:
mode:
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;