Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
StateMachine.cs
Go to the documentation of this file.
2
4
5internal sealed class StateMachine
6{
7 private int _State;
8
9 private static readonly int[][] s_BeginTransitions = new int[10][]
10 {
11 new int[12]
12 {
13 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
14 16, 16
15 },
16 new int[12]
17 {
18 40961, 42241, 16, 16, 41985, 16, 16, 41985, 40961, 106497,
19 16, 16
20 },
21 new int[12]
22 {
23 16, 261, 16, 16, 5, 16, 16, 5, 16, 16,
24 16, 16
25 },
26 new int[12]
27 {
28 16, 258, 16, 16, 2, 16, 16, 16, 16, 16,
29 16, 16
30 },
31 new int[12]
32 {
33 8200, 9480, 259, 3, 9224, 262, 6, 9224, 8, 73736,
34 10, 11
35 },
36 new int[12]
37 {
38 8200, 9480, 259, 3, 9224, 262, 6, 9224, 8, 73736,
39 10, 11
40 },
41 new int[12]
42 {
43 8200, 9480, 259, 3, 9224, 262, 6, 9224, 8, 73736,
44 10, 11
45 },
46 new int[12]
47 {
48 8203, 9483, 16, 16, 9227, 16, 16, 9227, 8203, 73739,
49 16, 16
50 },
51 new int[12]
52 {
53 8202, 9482, 16, 16, 9226, 16, 16, 9226, 8202, 73738,
54 16, 16
55 },
56 new int[12]
57 {
58 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
59 16, 16
60 }
61 };
62
63 private static readonly int[][] s_EndTransitions = new int[10][]
64 {
65 new int[12]
66 {
67 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
68 48, 48
69 },
70 new int[12]
71 {
72 48, 94217, 48, 48, 94729, 48, 48, 94729, 92681, 92681,
73 48, 48
74 },
75 new int[12]
76 {
77 48, 48, 48, 48, 48, 7, 519, 48, 48, 48,
78 48, 48
79 },
80 new int[12]
81 {
82 48, 48, 4, 516, 48, 48, 48, 48, 48, 48,
83 48, 48
84 },
85 new int[12]
86 {
87 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
88 48, 48
89 },
90 new int[12]
91 {
92 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
93 48, 48
94 },
95 new int[12]
96 {
97 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
98 48, 48
99 },
100 new int[12]
101 {
102 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
103 48, 16393
104 },
105 new int[12]
106 {
107 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
108 16393, 48
109 },
110 new int[12]
111 {
112 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
113 48, 48
114 }
115 };
116
117 internal int State
118 {
119 get
120 {
121 return _State;
122 }
123 set
124 {
125 _State = value;
126 }
127 }
128
129 internal StateMachine()
130 {
131 _State = 0;
132 }
133
134 internal void Reset()
135 {
136 _State = 0;
137 }
138
139 internal int BeginOutlook(XPathNodeType nodeType)
140 {
141 return s_BeginTransitions[(int)nodeType][_State];
142 }
143
144 internal int Begin(XPathNodeType nodeType)
145 {
146 int num = s_BeginTransitions[(int)nodeType][_State];
147 if (num != 16 && num != 32)
148 {
149 _State = num & 0xF;
150 }
151 return num;
152 }
153
154 internal int EndOutlook(XPathNodeType nodeType)
155 {
156 return s_EndTransitions[(int)nodeType][_State];
157 }
158
159 internal int End(XPathNodeType nodeType)
160 {
161 int num = s_EndTransitions[(int)nodeType][_State];
162 if (num != 16 && num != 32)
163 {
164 _State = num & 0xF;
165 }
166 return num;
167 }
168}
int BeginOutlook(XPathNodeType nodeType)
static readonly int[][] s_BeginTransitions
static readonly int[][] s_EndTransitions
int Begin(XPathNodeType nodeType)
int EndOutlook(XPathNodeType nodeType)
int End(XPathNodeType nodeType)