Exemple #1
0
 /// <summary>
 /// 状態マシンの終了。
 /// </summary>
 public void Stop()
 {
     if (currState != null)
     {
         List <FormState> pathList = currState.GetCanonicalPathList();
         ExitState(pathList, 0);
     }
 }
Exemple #2
0
        /// <summary>
        /// 状態遷移する
        /// </summary>
        private void DoTransitionState(string nextStateId)
        {
            //遷移先状態を取得
            FormState nextState = GetState(nextStateId);

            if (nextState == null)
            {
                logger.Error("遷移先状態が見つかりません。"
                             + "class " + currState.GetType().FullName + " "
                             + "状態パス:\"" + currState.GetCanonicalPath() + "\" から、\"" + currState.NextStateId + "\"");
            }

            //遷移元と先の状態でルート状態から共通の祖先状態の数を取得。
            List <FormState> nextStateParents = nextState.GetCanonicalPathList();
            List <FormState> currStateParents = currState.GetCanonicalPathList();
            int commonCount = GetCommonPathCount(nextStateParents, currStateParents);

            //現在状態から互いに共通の祖先の状態まで、すべての親状態のStateOutの処理を実行
            ExitState(currStateParents, commonCount);

            currState = nextState;//現在状態の書き換え

            //互いに共通の祖先の状態から遷移先状態まで順に降りながらStateInを実行する。
            transitionInProcess = false;
            EnterState(nextStateParents, commonCount);
        }
Exemple #3
0
        /// <summary>
        /// 状態マシンの開始。内包する状態の一番最初の状態から開始する。
        /// </summary>
        public void Start()
        {
            currState = GetFirstState(this);
            List <FormState> pathList = currState.GetCanonicalPathList();

            EnterState(pathList, 0);
        }