From 57e2e86742eea9b8e6e78742546406839b8f58cd Mon Sep 17 00:00:00 2001 From: Jorgen Brandt Date: Fri, 28 Apr 2017 23:04:22 +0200 Subject: [PATCH] Description fixed. --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a1fa5ff..5b5bc0f 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Here, we state that the transition `a` is enabled if it can consume a single `co #### fire/3 -The `fire/3` function defines what tokens are produced when a given transition fires in a given mode. As arguments it takes the name of the transition, and a firing mode in the form of a hash map mapping place names to token lists. The `fire/3` function is called only on modes for which `is_enabled/2` returns `true`. The `fire/3` function is expected to return either a `{produce, ProduceMap}` tuple or the term `abort`. If `abort` is returned, the firing is aborted. Nothing is produced or consumed. +The `fire/3` function defines what tokens are produced when a transition fires in a given mode. As arguments it takes the name of the transition, a firing mode in the form of a hash map mapping place names to token lists, and a user info field that was generated by `init/1`. The `fire/3` function is called only on modes for which `is_enabled/2` returns `true`. The `fire/3` function is expected to return either a `{produce, ProduceMap}` tuple or the atom `abort`. If `abort` is returned, the firing is canceled. I.e., nothing is produced or consumed. ```erlang fire( a, _Mode, _UsrInfo ) -> @@ -184,12 +184,14 @@ Here, we just ignore any message. #### init/1 -The `init/1` function initializes the net instance. It is given a start argument term which is the start argument term that was provided with `gen_pnet:start_link/3`. As a return value a tuple of the form `{ok, #net_state{}}` is expected. We can construct it with the help of `gen_pnet:new/2`. This function takes two arguments: The module implementing the net structure callback functions as well as a user-defined info field which we initialize with the empty list `[]`. +The `init/1` function initializes the net instance. It is given a start argument term which is the start argument term that was provided with `gen_pnet:start_link/3`. As a return value a tuple of the form `{ok, #net_state{}}` is expected. We can construct it with the help of `gen_pnet:new/2`. This function takes two arguments: The module implementing the net structure callback functions as well as a user info field. ```erlang init( _Args ) -> {ok, gen_pnet:new( ?MODULE, [] )}. ``` +Here we state that the actor interface module is also the net structure module. We initialize the user info field with the empty list `[]`. + #### terminate/2 The `terminate/2` function determines what happens when the net instance is stopped. The first argument is the reason for termination while the second argument is a `#net_state{}` record instance. This callback is identical to the `terminate/2` function in the gen_server behavior. @@ -200,7 +202,7 @@ terminate( _Reason, _NetState ) -> ok. #### trigger/3 -The `trigger/3` function determines what happens when a token is produced on a given place. Its first argument is the place name and its second argument is the token about to be produced. The `trigger/3` function is expected to return either `pass` in which case the token is produced normally, or `drop` in which case the token is forgotten. +The `trigger/3` function determines what happens when a token is produced on a given place. Its first argument is the place name, its second argument is the token about to be produced, and its third argument is the user info field generated by `init/1`. The `trigger/3` function is expected to return either `pass` in which case the token is produced normally, or `drop` in which case the token is forgotten. ```erlang trigger( _Place, _Token, _UsrInfo ) -> pass.