コード例 #1
0
        public INfa Kleene()
        {
            var newStart = new NfaState();
            var newEnd   = new NfaState();

            newStart.AddTransistion(new NullNfaTransition(Start));
            newStart.AddTransistion(new NullNfaTransition(newEnd));

            newEnd.AddTransistion(new NullNfaTransition(Start));
            End.AddTransistion(new NullNfaTransition(newEnd));

            return(new Nfa(newStart, newEnd));
        }
コード例 #2
0
        public INfa Union(INfa nfa)
        {
            var newStart = new NfaState();
            var newEnd   = new NfaState();

            newStart.AddTransistion(new NullNfaTransition(Start));
            newStart.AddTransistion(new NullNfaTransition(nfa.Start));

            End.AddTransistion(new NullNfaTransition(newEnd));
            nfa.End.AddTransistion(new NullNfaTransition(newEnd));

            return(new Nfa(newStart, newEnd));
        }
コード例 #3
0
 public INfa Concatenation(INfa nfa)
 {
     End.AddTransistion(
         new NullNfaTransition(nfa.Start));
     return(this);
 }