Commit 6b3552b9 authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Bug fixed in print_ifThenElse

parent afbe2372
......@@ -702,42 +702,49 @@ print_change_list(NumberOfSpecies,Print_helper_list, Species_order, Current_coun
Change_list = [[Lower, Upper], First_change, Constraint | Change_Tail],
nth1(Current_counter,Species_order,Species),
(
length(Change_list, Triple_of_change),
Triple_of_change > 0
length(Change_list, Triple_of_change),
Triple_of_change > 0
->
% First Change start with only "if".
format(Stream, " ~w = (if alpha_sum*ran>~w and alpha_sum*ran<=~w", [Species, Lower, Upper]),
format(Stream, " and ~w >0 then ~w", [Constraint, First_change]),
(
Change_number is (Triple_of_change / 3),
Change_number > 1
->
print_ifThenElse(Change_Tail, Stream)
;
!
),
% The last one.
format(Stream, "~n else ~w)", [Species]),
(
Current_counter = NumberOfSpecies
->
true
;
write(Stream,',')
),
nl(Stream)
% First Change start with only "if".
format(Stream, " ~w = (if alpha_sum*ran>~w and alpha_sum*ran<=~w", [Species, Lower, Upper]),
(
Constraint == '0'
->
true
;
format(Stream, " and ~w >0", [Constraint])
),
format(Stream, " then ~w", [First_change]),
(
Change_number is (Triple_of_change / 3),
Change_number > 1
->
print_ifThenElse(Change_Tail, Stream)
;
!
),
% The last one.
format(Stream, "~n else ~w)", [Species]),
(
Current_counter = NumberOfSpecies
->
true
;
write(Stream,',')
),
nl(Stream)
;
nth1(Current_counter, Species_order, Species_name),
write(Stream, Species_name)
nth1(Current_counter, Species_order, Species_name),
write(Stream, Species_name)
),
% Recursive condition on species
(
Current_counter < Last_counter
Current_counter < Last_counter
->
Next_counter is (Current_counter + 1),
print_change_list(NumberOfSpecies,Print_helper_list, Species_order, Next_counter, Last_counter, Stream)
Next_counter is (Current_counter + 1),
print_change_list(NumberOfSpecies,Print_helper_list, Species_order, Next_counter, Last_counter, Stream)
;
write(Stream, ').'), nl(Stream), !
write(Stream, ').'), nl(Stream), !
).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment