annotate Implab/Automaton/DFAStateDescriptor.cs @ 175:96a89dcb4060 ref20160224

sync
author cin
date Mon, 21 Mar 2016 18:41:45 +0300
parents 92d5278d1b10
children
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 {
172
92d5278d1b10 Working on text scanner
cin
parents: 169
diff changeset
2 public struct DFAStateDescriptor {
165
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
172
92d5278d1b10 Working on text scanner
cin
parents: 169
diff changeset
7 public DFAStateDescriptor(int[] transitions, bool final) {
165
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
172
92d5278d1b10 Working on text scanner
cin
parents: 169
diff changeset
12 public DFAStateDescriptor(int[] transitions) : this(transitions, false) {
165
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
13 }
169
54270c2f29f2 DFA refactoring
cin
parents: 165
diff changeset
14
172
92d5278d1b10 Working on text scanner
cin
parents: 169
diff changeset
15 public DFAStateDescriptor(int size, bool final) {
169
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 }