Skip to content

Commit

Permalink
Description fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
joergen7 committed Apr 28, 2017
1 parent 8ba06ae commit 57e2e86
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ->
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 57e2e86

Please sign in to comment.