From f20b3a198cd51d9742e6575beac7dd74b8b6b715 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 18 Feb 2017 20:32:32 +1100 Subject: Removed Add procedure from Bundles, cleaned up code slightly --- src/bundles-containers.adb | 12 +++++++----- src/bundles.adb | 10 ---------- src/bundles.ads | 5 ----- 3 files changed, 7 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/bundles-containers.adb b/src/bundles-containers.adb index 4c318d6..2dc9712 100644 --- a/src/bundles-containers.adb +++ b/src/bundles-containers.adb @@ -33,15 +33,18 @@ package body Bundles.Containers is begin if Current_Cursor /= Bundle_Maps.No_Element then declare - Vec_Ref : Bundle_Maps.Reference_Type := BMap.Reference (Current_Cursor); + Vec_Ref : Bundle_Maps.Reference_Type := + BMap.Reference (Current_Cursor); + Bundle_Ref : Bundle_Vectors.Reference_Type := + Vec_Ref.Reference (Vec_Ref.First_Index); begin - Add (Vec_Ref.Reference (Vec_Ref.First_Index), Item); + Bundle_Ref.Papers.Append (Item); end; else declare New_Bundle : Bundle := Empty_Bundle; begin - Add (New_Bundle, Item); + New_Bundle.Papers.Append (Item); BMap.Insert (Place, Bundle_Vectors.Empty_Vector & New_Bundle); end; end if; @@ -56,7 +59,6 @@ package body Bundles.Containers is is package My_CSV is new CSV; use Ada.Text_IO; - use type Ada.Containers.Count_Type; use type Candidates.CandidateID; Input_File : File_Type; @@ -68,7 +70,7 @@ package body Bundles.Containers is Result := Bundle_Maps.Empty_Map; while not End_Of_File (Input_File) loop Current_Record := My_CSV.Parse_Line (Get_Line (Input_File)); - if Current_Record.Length > 0 then + if Integer (Current_Record.Length) > 0 then Current_Prefs := Given_Prefs.Parse_Preferences (SU.To_String (Current_Record.Last_Element)); if Current_Prefs (Given_Prefs.Preference_Range'First) /= Candidates.No_Candidate then Add_To_Map (Result, Current_Prefs); diff --git a/src/bundles.adb b/src/bundles.adb index d0234a1..af11f37 100644 --- a/src/bundles.adb +++ b/src/bundles.adb @@ -11,16 +11,6 @@ package body Bundles is - procedure Add - (To : in out Bundle; - Item : in Given_Prefs.Preference_Array) is - begin - To.Papers.Append (Item); - end Add; - - - - procedure Transfer (This : in out Bundle; From, To : in Candidates.CandidateID; diff --git a/src/bundles.ads b/src/bundles.ads index 5ea5dac..6d95693 100644 --- a/src/bundles.ads +++ b/src/bundles.ads @@ -25,11 +25,6 @@ package Bundles is Empty_Bundle : constant Bundle; - procedure Add - (To : in out Bundle; - Item : in Given_Prefs.Preference_Array); - - procedure Transfer (This : in out Bundle; From, To : in Candidates.CandidateID; -- cgit