Beispiel #1
0
        private void AddTransitions(MagnetPoint prev, MagnetPoint next, string input)
        {
            Transition_Wrapper currTrans = _lstTransFunc.Find(x => x.TransitionFunction.PrevState == prev.State.Name && x.TransitionFunction.Input == input);

            if (!currTrans.IsNull)
            {
                throw new Exception("something not deleted");
            }
            _lstTransFunc.Add(new Transition_Wrapper(new TransFunc(prev.State.Name, input, next.State.Name), prev, next));

            TransFunc[] dummy = new TransFunc[_lstTransFunc.Count];
            for (int i = 0; i < _lstTransFunc.Count; i++)
            {
                dummy[i] = _lstTransFunc[i].TransitionFunction;
            }

            _dfa.Transitions = dummy;
            DFAIsEdited?.Invoke();
        }
Beispiel #2
0
        private Transition_Wrapper DeleteTransitions(State_Wrapper prev, string input)
        {
            Transition_Wrapper currTrans = _lstTransFunc.Find(x => x.TransitionFunction.PrevState == prev.Name && x.TransitionFunction.Input == input);

            if (!currTrans.IsNull)
            {
                _lstTransFunc.Remove(currTrans);

                TransFunc[] dummy = new TransFunc[_lstTransFunc.Count];
                for (int i = 0; i < _lstTransFunc.Count; i++)
                {
                    dummy[i] = _lstTransFunc[i].TransitionFunction;
                }

                _dfa.Transitions = dummy;
                return(currTrans);
            }
            else
            {
                return(new Transition_Wrapper(null, new MagnetPoint(), new MagnetPoint()));
            }
        }
Beispiel #3
0
 public void NullIt()
 {
     TransitionFunction = null;
     SourceIndex.NullIt();
     DestinationIndex.NullIt();
 }
Beispiel #4
0
 public Transition_Wrapper(TransFunc x, MagnetPoint src, MagnetPoint dst)
 {
     TransitionFunction = x;
     SourceIndex        = src;
     DestinationIndex   = dst;
 }