Esempio n. 1
0
            /// <summary>
            /// Ensure that the supplied arguments are compatible with those configured for this
            /// trigger.
            /// </summary>
            /// <param name="args"></param>
            public void ValidateParameters(object[] args)
            {
                Enforce.ArgumentNotNull(args, "args");

                ParameterConversion.Validate(args, _argumentTypes);
            }
Esempio n. 2
0
 public DynamicTriggerBehaviour(TTrigger trigger, Func <object[], TState> destination, Func <bool> guard, string description)
     : base(trigger, guard, description)
 {
     _destination = Enforce.ArgumentNotNull(destination, "destination");
 }
Esempio n. 3
0
 protected TriggerBehaviour(TTrigger trigger, Func <bool> guard, string guardDescription)
 {
     _trigger          = trigger;
     _guard            = guard;
     _guardDescription = Enforce.ArgumentNotNull(guardDescription, nameof(guardDescription));
 }
Esempio n. 4
0
 public void AddSubstate(StateRepresentation substate)
 {
     Enforce.ArgumentNotNull(substate, nameof(substate));
     _substates.Add(substate);
 }
Esempio n. 5
0
 /// <summary>
 /// Construct a state machine with external state storage.
 /// </summary>
 /// <param name="stateAccessor">A function that will be called to read the current state value.</param>
 /// <param name="stateMutator">An action that will be called to write new state values.</param>
 public StateMachine(Func <TState> stateAccessor, Action <TState> stateMutator)
 {
     _stateAccessor = Enforce.ArgumentNotNull(stateAccessor, "stateAccessor");
     _stateMutator  = Enforce.ArgumentNotNull(stateMutator, "stateMutator");
 }
Esempio n. 6
0
 /// <summary>
 /// Transition from the current state via the specified trigger.
 /// The target state is determined by the configuration of the current state.
 /// Actions associated with leaving the current state and entering the new one
 /// will be invoked.
 /// </summary>
 /// <typeparam name="TArg0">Type of the first trigger argument.</typeparam>
 /// <typeparam name="TArg1">Type of the second trigger argument.</typeparam>
 /// <typeparam name="TArg2">Type of the third trigger argument.</typeparam>
 /// <param name="arg0">The first argument.</param>
 /// <param name="arg1">The second argument.</param>
 /// <param name="arg2">The third argument.</param>
 /// <param name="trigger">The trigger to fire.</param>
 /// <exception cref="System.InvalidOperationException">The current state does
 /// not allow the trigger to be fired.</exception>
 public void Fire <TArg0, TArg1, TArg2>(TriggerWithParameters <TArg0, TArg1, TArg2> trigger, TArg0 arg0, TArg1 arg1, TArg2 arg2)
 {
     Enforce.ArgumentNotNull(trigger, "trigger");
     InternalFire(trigger.Trigger, arg0, arg1, arg2);
 }
Esempio n. 7
0
 StateConfiguration InternalPermitIf(TTrigger trigger, TState destinationState, Func <bool> guard, string guardDescription)
 {
     Enforce.ArgumentNotNull(guard, nameof(guard));
     _representation.AddTriggerBehaviour(new TransitioningTriggerBehaviour(trigger, destinationState, guard, guardDescription));
     return(this);
 }
Esempio n. 8
0
 internal StateConfiguration(StateRepresentation representation, Func <TState, StateRepresentation> lookup)
 {
     _representation = Enforce.ArgumentNotNull(representation, nameof(representation));
     _lookup         = Enforce.ArgumentNotNull(lookup, nameof(lookup));
 }
Esempio n. 9
0
 public ExitActionBehavior(Action <Transition> action, string actionDescription)
 {
     _action            = action;
     _actionDescription = Enforce.ArgumentNotNull(actionDescription, nameof(actionDescription));
 }