Пример #1
0
        public void PushStackFrame(PrtState state)
        {
            var deferredSet = new HashSet <PrtValue>();

            if (TopOfStack != null)
            {
                deferredSet.UnionWith(TopOfStack.deferredSet);
            }
            deferredSet.UnionWith(state.deferredSet);
            deferredSet.ExceptWith(state.dos.Keys);
            deferredSet.ExceptWith(state.transitions.Keys);

            var actionSet = new HashSet <PrtValue>();

            if (TopOfStack != null)
            {
                actionSet.UnionWith(TopOfStack.actionSet);
            }
            actionSet.ExceptWith(state.deferredSet);
            actionSet.UnionWith(state.dos.Keys);
            actionSet.ExceptWith(state.transitions.Keys);

            //push the new state on stack
            stateStack.Push(new PrtStateStackFrame(state, deferredSet, actionSet));
        }
Пример #2
0
        public PrtStateStackFrame(PrtState st, HashSet <PrtValue> defSet, HashSet <PrtValue> actSet)
        {
            this.state       = st;
            this.deferredSet = new HashSet <PrtValue>();
            foreach (var item in defSet)
            {
                this.deferredSet.Add(item);
            }

            this.actionSet = new HashSet <PrtValue>();
            foreach (var item in actSet)
            {
                this.actionSet.Add(item);
            }
        }
Пример #3
0
 public void PrtPushState(PrtState s)
 {
     stateStack.PushStackFrame(s);
 }
Пример #4
0
 public PrtTransition(PrtFun fun, PrtState toState, bool isPush)
 {
     this.transitionFun = fun;
     this.gotoState     = toState;
     this.isPushTran    = isPush;
 }
Пример #5
0
 public void PrtChangeState(PrtState s)
 {
     Debug.Assert(stateStack.TopOfStack != null);
     stateStack.PopStackFrame();
     stateStack.PushStackFrame(s);
 }