annotate Implab/Automaton/DFAStateDescriptor.cs @ 169:54270c2f29f2 ref20160224

DFA refactoring
author cin
date Thu, 03 Mar 2016 08:41:02 +0300
parents e227e78d72e4
children 92d5278d1b10
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
164
ec35731ae299 Almost complete DFA refactoring
cin
parents: 162
diff changeset
1 namespace Implab.Automaton {
165
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
2 public struct DFAStateDescriptior {
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
3 public readonly bool final;
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
4 public readonly int[] transitions;
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
5
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
6
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
7 public DFAStateDescriptior(int[] transitions, bool final) {
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
8 this.transitions = transitions;
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
9 this.final = final;
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
10 }
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
11
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
12 public DFAStateDescriptior(int[] transitions) : this(transitions, false) {
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
13 }
169
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
14
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
15 public DFAStateDescriptior(int size, bool final) {
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
16 Safe.ArgumentInRange(size, 0, int.MaxValue, "size");
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
17
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
18 this.final = final;
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
19
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
20 transitions = new int[size];
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
21
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
22 for (int i = 0; i < size; i++)
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
23 transitions[i] = DFAConst.UNREACHABLE_STATE;
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
24 }
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
25 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
26 }