|
30 | 30 | %% <li>`trsn_lst/0' returns the names of the transitions in the net</li>
|
31 | 31 | %% <li>`init_marking/2' returns the initial marking for a given place</li>
|
32 | 32 | %% <li>`preset/1' returns the preset places of a given transition</li>
|
33 |
| -%% <li>`is_enabled/2' determines whether a given transition is enabled in a |
| 33 | +%% <li>`is_enabled/3' determines whether a given transition is enabled in a |
34 | 34 | %% given mode</li>
|
35 | 35 | %% <li>`fire/3' returns which tokens are produced on what places if a given
|
36 | 36 | %% transition is fired in a given mode that enables this transition</li>
|
|
90 | 90 | %% Here, we initialize the storage place with three `cookie_box' tokens. All
|
91 | 91 | %% other places are left empty.
|
92 | 92 | %%
|
93 |
| -%% <h4>is_enabled/2</h4> |
| 93 | +%% <h4>is_enabled/3</h4> |
94 | 94 | %%
|
95 |
| -%% The `is_enabled/2' function is a predicate determining whether a given |
96 |
| -%% transition is enabled in a given mode. |
| 95 | +%% The `is_enabled/3' function is a predicate determining whether a given |
| 96 | +%% transition is enabled in a given mode. The `UsrInfo' argument is the user |
| 97 | +%% info field that has been created with `init/1'. |
97 | 98 | %%
|
98 | 99 | %% Example:
|
99 | 100 | %% ```
|
100 |
| -%% is_enabled( a, #{ coin_slot := [coin] } ) -> true; |
101 |
| -%% is_enabled( b, #{ signal := [sig], storage := [cookie_box] } ) -> true; |
102 |
| -%% is_enabled( _, _ ) -> false. |
| 101 | +%% is_enabled( a, #{ coin_slot := [coin] }, _UsrInfo ) -> true; |
| 102 | +%% is_enabled( b, #{ signal := [sig], storage := [cookie_box] }, _UsrInfo ) -> true; |
| 103 | +%% is_enabled( _Trsn, _Mode, _UsrInfo ) -> false. |
103 | 104 | %% '''
|
104 | 105 | %% Here, we state that the transition `a' is enabled if it can consume a single
|
105 | 106 | %% `coin' from the `coin_slot' place. Similarly, the transition `b' is enabled
|
|
114 | 115 | %% transition fires in a given mode. As arguments it takes the name of the
|
115 | 116 | %% transition, and a firing mode in the form of a hash map mapping place names
|
116 | 117 | %% to token lists. The `fire/3' function is called only on modes for which
|
117 |
| -%% `is_enabled/2' returns `true'. The `fire/3' function is expected to return |
| 118 | +%% `is_enabled/3' returns `true'. The `fire/3' function is expected to return |
118 | 119 | %% either a `{produce, ProduceMap}' tuple or the term `abort'. If `abort' is
|
119 | 120 | %% returned, the firing is aborted. Nothing is produced or consumed.
|
120 | 121 | %%
|
|
146 | 147 |
|
147 | 148 | -callback preset( Trsn :: atom() ) -> [atom()].
|
148 | 149 |
|
149 |
| --callback is_enabled( Trsn :: atom(), Mode :: #{ atom() => [_]} ) -> boolean(). |
| 150 | +-callback is_enabled( Trsn :: atom(), Mode :: #{ atom() => [_]}, UsrInfo :: _ ) -> |
| 151 | + boolean(). |
150 | 152 |
|
151 | 153 | -callback fire( Trsn :: atom(), Mode :: #{ atom() => [_] }, UsrInfo :: _ ) ->
|
152 | 154 | abort | {produce, #{ atom() => [_] }}.
|
0 commit comments