diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bundles-containers.adb | 7 | ||||
-rw-r--r-- | src/election.adb | 12 | ||||
-rw-r--r-- | src/preferences.adb | 2 | ||||
-rw-r--r-- | src/stv.adb | 12 |
4 files changed, 21 insertions, 12 deletions
diff --git a/src/bundles-containers.adb b/src/bundles-containers.adb index 1e566fa..a3e2ef0 100644 --- a/src/bundles-containers.adb +++ b/src/bundles-containers.adb @@ -65,8 +65,11 @@ package body Bundles.Containers is while not End_Of_File (Input_File) loop Current_Record := My_CSV.Parse_Line (Get_Line (Input_File)); 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 + 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); end if; end if; diff --git a/src/election.adb b/src/election.adb index 181da64..6a7892f 100644 --- a/src/election.adb +++ b/src/election.adb @@ -467,7 +467,8 @@ package body Election is Fractional_Loss => Fractional_Loss, Exhausted_Loss => Exhausted_Loss); - Pref_Data.Reference (This_Transfer.From).Delete (Pref_Data.Reference (This_Transfer.From).First_Index); + Pref_Data.Reference (This_Transfer.From).Delete + (Pref_Data.Reference (This_Transfer.From).First_Index); Fractional.Paper_Change := Fractional.Paper_Change + Fractional_Loss; Exhausted.Paper_Change := Exhausted.Paper_Change + Exhausted_Loss; @@ -478,13 +479,13 @@ package body Election is Entry_Ref : Entry_Vectors.Reference_Type := Entries.Reference (This_Transfer.Position); begin - Entry_Ref.Paper_Change := - Entry_Ref.Total_Papers; + Entry_Ref.Paper_Change := -Entry_Ref.Total_Papers; Entry_Ref.Total_Papers := 0; if Entry_Ref.Status = Elected then Entry_Ref.Vote_Change := Quota - Entry_Ref.Total_Votes; Entry_Ref.Total_Votes := Quota; else - Entry_Ref.Vote_Change := - Entry_Ref.Total_Votes; + Entry_Ref.Vote_Change := -Entry_Ref.Total_Votes; Entry_Ref.Total_Votes := 0; end if; end; @@ -557,14 +558,15 @@ package body Election is for R in Running.Iterate loop Votes_To_Be_Excluded := Running.Reference (R).Total_Votes; - exit when Number_Excluded > 0 and Votes_Excluded + Votes_To_Be_Excluded > Applied_Breakpoint; + exit when Number_Excluded > 0 and + Votes_Excluded + Votes_To_Be_Excluded > Applied_Breakpoint; Working_Position := Running.Reference (R).Index; Working_ID := Entries.Reference (Working_Position).ID; Entries.Reference (Working_Position).Status := Excluded; Entries.Reference (Working_Position).Changed := True; - Transfers.Append ( (From => Working_ID, Position => Working_Position, Value => 1 / 1) ); + Transfers.Append ((From => Working_ID, Position => Working_Position, Value => 1 / 1)); Votes_Excluded := Votes_Excluded + Votes_To_Be_Excluded; Number_Excluded := Number_Excluded + 1; end loop; diff --git a/src/preferences.adb b/src/preferences.adb index 36cc5ea..6868042 100644 --- a/src/preferences.adb +++ b/src/preferences.adb @@ -63,7 +63,7 @@ package body Preferences is Pref_Loop : for I in Above_Range loop Above_IC (Above_Input, Integer (I), Working_Index, Working_Count); - exit when Working_Count /= 1; + exit Pref_Loop when Working_Count /= 1; Extracted := Extracted + 1; for C of Above_Ballot.Element (Integer (Working_Index)) loop exit Pref_Loop when Formal_Index > Preference_Range'Last; diff --git a/src/stv.adb b/src/stv.adb index a83689f..2facffa 100644 --- a/src/stv.adb +++ b/src/stv.adb @@ -154,7 +154,8 @@ begin return; end if; if File.Kind (Candidate_File.all) /= File.Ordinary_File then - Put_Line ("Candidate data file name appears to refer to a directory or special file." & ASCII.LF & Further_Help); + Put_Line ("Candidate data file name appears to refer to a directory or special file." & + ASCII.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; @@ -172,7 +173,8 @@ begin return; end if; if File.Kind (Preference_File.all) /= File.Ordinary_File then - Put_Line ("Preference data file name appears to refer to a directory or special file." & ASCII.LF & Further_Help); + Put_Line ("Preference data file name appears to refer to a directory or special file." & + ASCII.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end if; @@ -204,7 +206,8 @@ begin State := Candidates.State_Name'Value (State_String.all); exception when Constraint_Error => - Put_Line ("Invalid State/Territory or State/Territory not provided." & ASCII.LF & Further_Help); + Put_Line ("Invalid State/Territory or State/Territory not provided." & + ASCII.LF & Further_Help); ACom.Set_Exit_Status (ACom.Failure); return; end; @@ -214,7 +217,8 @@ begin File.Create_Directory (Output_Dir.all); Start_Time := Simple_Time.Now; Main_Log := SU.To_Unbounded_String (Output_Dir.all & "/" & "log.txt"); - Log_Msg := SU.To_Unbounded_String ("Started election count at " & Simple_Time.To_String (Start_Time)); + Log_Msg := SU.To_Unbounded_String ("Started election count at " & + Simple_Time.To_String (Start_Time)); Create (Log_File, Append_File, SU.To_String (Main_Log)); Put_Line (Log_File, SU.To_String (Log_Msg)); Close (Log_File); |