Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rename simple_agent to agent

  • Loading branch information...
commit e15acb18a5527714ba62d85184a60111a33367be 1 parent de888bf
@gleber authored
View
4 examples/jade/exat_agent.erl
@@ -2,7 +2,7 @@
-export([start/0]).
--behaviour(simple_agent).
+-behaviour(agent).
-export([code_change/3, handle_acl/2, handle_call/3,
handle_cast/2, handle_info/2, init/2,
@@ -15,7 +15,7 @@
-record(state, {name}).
start() ->
- simple_agent:new(the_exat_agent, the_exat_agent, [{behaviour, exat_agent}]).
+ agent:new(the_exat_agent, the_exat_agent, [{behaviour, exat_agent}]).
handle_acl(#aclmessage{speechact = 'REQUEST'} = Message, #state{self = Self} = State) ->
io:format("[Agent:~w] Request received from agent ~p\n",
View
2  examples/simple/run_second.sh
@@ -5,5 +5,5 @@ erl -pa examples/simple -pa ebin/ -pa lib/*/ebin/ -pa ../../ebin/ -boot start_sa
-http_port 7779 \
-start simple_pingeragent $*
- # -eval "t:t(simple_agent)." \
+ # -eval "t:t(agent)." \
# -eval "t:t(simple_pingeragent)." \
View
6 examples/simple/simple_pingagent.erl
@@ -1,6 +1,6 @@
-module(simple_pingagent).
--behaviour(simple_agent).
+-behaviour(agent).
-export([start/0, stop/0]). % API
@@ -13,9 +13,9 @@
%%API
-start() -> simple_agent:new(pingagent, ?MODULE, []).
+start() -> agent:new(pingagent, ?MODULE, []).
-stop() -> simple_agent:stop(pingagent).
+stop() -> agent:stop(pingagent).
%%agents callback
View
8 examples/simple/simple_pingeragent.erl
@@ -1,6 +1,6 @@
-module(simple_pingeragent).
--behaviour(simple_agent).
+-behaviour(agent).
-export([start/0, stop/0]). % API
@@ -14,10 +14,10 @@
%%API
start() ->
- simple_agent:new(pingeragent, ?MODULE,
- [{"localhost", 7778, "pingagent"}]).
+ agent:new(pingeragent, ?MODULE,
+ [{"localhost", 7778, "pingagent"}]).
-stop() -> simple_agent:stop(pingeragent).
+stop() -> agent:stop(pingeragent).
%%agents callback
handle_acl(#aclmessage{speechact = 'INFORM',
View
10 src/simple_agent.erl → src/agent.erl
@@ -1,5 +1,5 @@
%%
-%% simple_agent.erl
+%% agent.erl
%%
%% ----------------------------------------------------------------------
%%
@@ -19,7 +19,7 @@
%% You should have received a copy of the GNU General Public License
%% along with this program. If not, see <http://www.gnu.org/licenses/>
--module(simple_agent).
+-module(agent).
-behaviour(gen_server).
@@ -55,7 +55,7 @@ new(AgentName, Callback) ->
new(AgentName, Callback, Parameters) ->
gen_server:start({local, AgentName},
- simple_agent, [AgentName, Callback, Parameters],
+ agent, [AgentName, Callback, Parameters],
[]).
%%
@@ -77,7 +77,7 @@ get_mind(_Pid) -> erlang:error(notimpl).
get_acl_semantics(_Pid) -> erlang:error(notimpl).
stop(Agent) ->
- gen_server:cast(Agent, '$simple_agent_stop').
+ gen_server:cast(Agent, '$agent_stop').
kill(Agent) -> stop(Agent).
@@ -155,7 +155,7 @@ handle_call(Call, From,
%% Stops the agent process
%%
-handle_cast('$simple_agent_stop', State) ->
+handle_cast('$agent_stop', State) ->
{stop, normal, State};
handle_cast(Cast,
#state{int_state = IntState, callback = Callback} =
View
4 src/ams.erl
@@ -38,7 +38,7 @@
-export([de_register_agent/1, get_registered_agents/0,
register_agent/1, start_link/0]).
--behaviour(simple_agent).
+-behaviour(agent).
-export([code_change/3, handle_acl/2, handle_call/3,
handle_cast/2, handle_info/2, init/2,
@@ -87,7 +87,7 @@ prepare_reply(Content = #action{'1' = #search{'0' = #'ams-agent-description'{}}}
%% Returns: {ok, Pid}.
%%====================================================================
start_link() ->
- simple_agent:new(ams, ams, [{behaviour, ams}]).
+ agent:new(ams, ams, [{behaviour, ams}]).
init(ams, Params) ->
logger:start('AMS'),
Please sign in to comment.
Something went wrong with that request. Please try again.