Action0<State, System, R> constructor
Action0<State, System, R> (})
Creates a new action command with no arbitrary.
Parameters:
description
: The description of the action.nextState
: A function to update the state.run
: A function to perform the action.precondition
: A function to test the precondition of the action.postcondition
: A function to test the postcondition of the action.
Implementation
Action0(
String description, {
required void Function(State) nextState,
required R Function(System) run,
bool Function(State)? precondition,
bool Function(State, R)? postcondition,
}) : super(
description,
null,
nextState: (s, _) => nextState(s),
run: (sys, _) => run(sys),
precondition: (s, _) => precondition?.call(s) ?? true,
postcondition: (s, _, r) => postcondition?.call(s, r) ?? true,
);