예제 #1
0
        /// <summary>
        /// Creates a transition.
        /// </summary>
        /// <param name="name">User assigned name for transition.</param>
        /// <param name="source">Transition source.</param>
        /// <param name="target">Transition target.</param>
        /// <param name="trigger">Transition trigger.</param>
        /// <param name="guard">Transition guard.</param>
        /// <param name="action">Transition action.</param>
        /// <remarks>Deprecated - Use NSFExternalTransition or NSFLocalTransition</remarks>
        protected NSFTransition(NSFString name, NSFState source, NSFState target, NSFEvent trigger, NSFBoolGuard <NSFStateMachineContext> guard, NSFVoidAction <NSFStateMachineContext> action)
            : base(name)
        {
            this.source = source;
            this.target = target;
            Guards     += guard;
            Actions    += action;

            addTrigger(trigger);

            // Validity check
            if ((source == target) && (triggers.Count == 0) && Guards.isEmpty())
            {
                throw new Exception(Name + " invalid self-transition with no trigger or guard");
            }

            target.addIncomingTransition(this);
            // Outgoing transitions must be added by concrete classes

            Guards.setExceptionAction(handleGuardException);
            Actions.setExceptionAction(handleActionException);
        }