The AAIMBehavior serves as the central coordinator of the system's behavior on state changes and transitions.
Parameters
situationFactorySituationFactory The SituationFactory instance to use for the creation of situations configured in state configurations.defaultServiceAAIMService The AAIMService instance to use for method calls without a service name specified, may be undefined.
Executes a state configuration
Parameters
-
configAAIM.StateBehavior The state configuration object -
Throws Error If the given state configuration can not be executed due to an error.
Executes a transition configuration
Parameters
configAAIM.ServiceCall The transition configuration object
Returns Promise A Promise to the result of the executed transition.
Registers a service with a given name.
Parameters
-
nameString The non-empty name under which the service should be registered. -
serviceAAIMService The actual service implementation to register. -
Throws Error If name is empty or already taken or service seems not to be a valid AAIMService implementation.
Resolves the given array of parameter values and parameter references into an array of values.
Parameters
parametersArray The parameter array to resolve.
Returns Array The array of resolved values.
Performs a service call according to a given configuration object including resolving or fetching parameters and mapping parameters and the result.
Parameters
-
configAAIM.ServiceCall The configuration object of the service call to be performed. -
defaultParametersArray List of parameter values to use, if no parameters are configured. -
Throws Error If the given configuration is invalid.
Returns Promise A Promise to the result of the service call.
A structured object defining a service call to be executed.
Type: Object
Properties
serviceString? The name of the service to call orundefinedto use the default servicenameString The name of the service method to callparameters(Array<AAIM.Param> | AAIM.ServiceCall)? The parameters to be handed over to the specified service method or a call to another service method to fetch thoseparameterMappingArray<AAIM.ServiceCall>? Service methods that are called to map the given parameters one by one mathed by index. That means, the first parameter handed to the first mapping method and so on.resultMappingAAIM.ServiceCall? Service method that is called to map the result of this service call.
Examples
{
service: <name of registered serivce>,
name: <method name>,
parameters: [
<parameter value> or <data context reference>, ...
] or <service call configuration>,
parameterMapping: [
<service call configuration>, ...
],
resultMapping: <service call configuration>
}A structured object configuring the behavior in a state.
Type: Object
Properties
situationString The name of the situation that will be handed over to the SituationFactoryparameters(Array<AAIM.Param> | AAIM.ServiceCall)? The parameters to be handed over to the SituationFactory or a call to a service method to fetch thoseparameterMappingArray<AAIM.ServiceCall>? Service methods that are called to map the given parameters one by one mathed by index. That means, the first parameter handed to the first mapping method and so on.
Examples
{
situation: <situation identifier>,
parameters: [
<parameter value> or <data context reference>, ...
] or <service call configuration>,
parameterMapping: [
<service call configuration>, ...
]
}A list of parameter values or data context references. The notation of references to the data context uses the style of expressions in template literals.
Type: Any
Examples
'${foo.bar}' // will be resolved to the value of the "bar" property of the "foo" object in the data context.A structured object representing an Abstract Application Interaction Model (AAIM).
Type: Object
Properties
initialString The name of the inital statestatesArray<AAIM.State> A list of all the states in this AAIM
Examples
{
initial: <name of initial state>,
states: [
{
name: <name of the state>,
do: <behavior configuration>
events: [
{
on: <name of event>,
goto: <name of target state>,
do: <behavior configuration>
}, ...
]
}, ...
]
}The AAIMInterpreter takes an AAIM object and interpretes the state machine it represents. The execution of states and transitions triggered by events is delegated to an AAIMBehavior.
Parameters
behaviorAAIMBehavior The AAIMBehavior implementation the execution of the application states is delegated to.
Returns if the interpreter is currently running.
Returns Boolean true, if the interpreter is running, false otherwise
Sets the interpreter to run or to pause. The interpreter can only be set to running, if an AAIM is loaded. The interpreter upholds the current state when getting paused and restarted. To restart the AAIM in its initial state call AAIMInterpreter#reset after pausing the interpreter.
Parameters
runBoolean true to run the interpreter, false to pause
Returns the currently loaded AAIM.
Returns Object the currently loaded AAIM or undefined
Returns the current state of the AAIM.
Returns Object the current state or undefined
Loads an AAIM.
Parameters
aaimAAIM The javascript object representing the AAIM.
Resets a paused interpreter. After the reset the interpreter will be in the same state as directly after loading an AAIM (a.k.a. the initial state). Calls to this method will have no effect if the interpreter is currently running.
Executes an event on the current state of the interpreter by its name. An event name not defined for the current state will have no effect. Calls to this method will have no effect if the interpreter is currently paused.
Parameters
nameString The name of the event so execute
A structured object representing a single state of an AAIM.
Type: Object
Properties
nameString The unique name of the statedoAAIM.StateBehavior An object containing the behavior configuration to be handed over to the AAIMBehavioreventsArray<AAIM.Event> A list of events triggering transitions
A structured object representing a transition triggered by an event.
Type: Object
Properties
nameString The name of the event (unique in its containing state)gotoString The name of the target statedoAAIM.ServiceCall An object containing the behavior configuration to be handed over to the AAIMBehavior
AAIMService serves as a base class for the implementation of configurable services that can be used in AAIM do-configurations.
Provided methods by name
Calls a function by its name applying the provided parameters.
Parameters
-
methodString The name of the method to call. -
paramsArray The parameters to call the function with. -
Throws Error If no function with the requested name is provided by this service.
Returns Promise A promise to the result of the function call
Checks if a function is provided by this service.
Parameters
methodString The name of the method to check.
Returns Boolean true if a method with the given name is provided by this service, false otherwise.
Parameters
Parameters