events.pl 805 Bytes
Newer Older
Thierry Martinez's avatar
Thierry Martinez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
:- module(
  events,
  [
    add_event/2,
    list_events/0
  ]
).


add_event(Condition, ParameterValues) :-
  biocham_command(*),
  type(Condition, condition),
  type(ParameterValues, '*'(parameter = simple_kinetics)),
  doc('
    sets up an event that will be fired each time the condition given as first
    argument goes from false to true.
    This command is effective in numerical simulations only.
    Upon firing, the parameters receive new values
    computed from the expression.
    The initial values of the parameters are restored after the simulation.'),
  \+ (
    member(ParameterValue, ParameterValues),
    \+ (
      add_item(event, event(Condition, ParameterValue))
    )
  ).


list_events :-
  biocham_command,
  doc('lists all the declared events.'),
  list_items([kind: event]).