Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace OOP14_BehaviourPatternsState
- {
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- interface IDFAState
- {
- void q0(); // Start
- void q1();
- void q2();
- void q3(); // Accept
- void
- }
- /*
- class DFAState : IDFAState
- {
- private DFA _dfa;
- public DFAState(DFA dfa)
- {
- _dfa = dfa;
- }
- public void q0() { }
- public void q1() { }
- public void q2() { }
- public void q3() { }
- }*/
- class q0State : IDFAState
- {
- private DFA _dfa;
- public q0State(DFA dfa)
- {
- _dfa = dfa;
- }
- public void q0() { }
- public void q1() { }
- public void q2() { }
- public void q3() { }
- }
- class q1State : IDFAState
- {
- private DFA _dfa;
- public q1State(DFA dfa)
- {
- _dfa = dfa;
- }
- public void q0() { }
- public void q1() { }
- public void q2() { }
- public void q3() { }
- }
- class q2State : IDFAState
- {
- private DFA _dfa;
- public q2State(DFA dfa)
- {
- _dfa = dfa;
- }
- public void q0() { }
- public void q1() { }
- public void q2() { }
- public void q3() { }
- }
- class q3State : IDFAState
- {
- private DFA _dfa;
- public q3State(DFA dfa)
- {
- _dfa = dfa;
- }
- public void q0() { }
- public void q1() { }
- public void q2() { }
- public void q3() { }
- }
- class DFA
- {
- public readonly q0State _q0state;
- public readonly q1State _q1state;
- public readonly q2State _q2state;
- public readonly q3State _q3state;
- public IDFAState state;
- public DFA()
- {
- _q0state = new q0State(this);
- _q1state = new q1State(this);
- _q2state = new q2State(this);
- _q3state = new q3State(this);
- state = _q0state;
- }
- public string Input { get; set; }
- public bool Check()
- {
- return true;
- }
- public void NextState(int pos)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement