Skip to content

Commit 1b065b9

Browse files
committed
Minor refactorings
1 parent 31ff46e commit 1b065b9

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/mas.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ start() ->
2424
%%------------------------------------------------------------------------------
2525
%% @doc Starts simulation with provided simulation parameters. Simulation
2626
%% terminates automaticaly if given time constraint is a positive integer.
27-
%% Otherwise simulation runs infinitely.
27+
%% Otherwise simulation runs infinitely. MAS engine is able to process
28+
%% only one simulation at once.
2829
%% @end
2930
%%------------------------------------------------------------------------------
3031
start_simulation(SP, Time) ->

src/mas_population.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ handle_cast(_Msg, State) ->
9292
%% @private
9393
%%------------------------------------------------------------------------------
9494
handle_info(process_population, State) ->
95-
NewState = process_population(State),
9695
self() ! process_population,
97-
{noreply, NewState};
96+
{noreply, process_population(State)};
9897
handle_info(update_metrics, State = #state{config = Config}) ->
9998
schedule_metrics_update(Config),
10099
{noreply, update_metrics(State)};

src/mas_simulation.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ start_link(Config) ->
5454
%%------------------------------------------------------------------------------
5555
%% @doc Starts simulation with provided simulation parameters. Simulation
5656
%% terminates automaticaly if given time constraint is a positive integer.
57-
%% Otherwise simulation runs infinitely. MAS engine is able to process
58-
%% only one simulation at once.
57+
%% Otherwise simulation runs infinitely.
5958
%% @end
6059
%%------------------------------------------------------------------------------
6160
start_simulation(SP, Time) ->

src/mas_world.erl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ init(#config{population_count = Count, topology = Topology}) ->
7373
%% @private
7474
%%------------------------------------------------------------------------------
7575
handle_call(get_agents, _From, State = #state{populations = Populations}) ->
76-
Agents = collect_agents(Populations),
77-
{reply, {agents, Agents}, State};
76+
{reply, {agents, collect_agents(Populations)}, State};
7877
handle_call(_Request, _From, State) ->
7978
{reply, ignored, State}.
8079

@@ -97,8 +96,7 @@ handle_cast(_Msg, State) ->
9796
%% @private
9897
%%------------------------------------------------------------------------------
9998
handle_info(spawn_populations, State = #state{population_count = Count}) ->
100-
Populations = spawn_populations(Count),
101-
{noreply, State#state{populations = Populations}};
99+
{noreply, State#state{populations = spawn_populations(Count)}};
102100
handle_info(_Info, State) ->
103101
{noreply, State}.
104102

0 commit comments

Comments
 (0)