annotate Implab/Automaton/AutomatonTransition.cs @ 260:547a2fc0d93e v3 v3.0.6

minor fixes
author cin
date Fri, 13 Apr 2018 19:14:59 +0300
parents d6fe09f5592c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
1 using System;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
2
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
3 namespace Implab.Automaton {
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 205
diff changeset
4 public class AutomatonTransition : IEquatable<AutomatonTransition> {
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
5 public readonly int s1;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
6 public readonly int s2;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
7 public readonly int edge;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
8
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
9 public AutomatonTransition(int s1, int s2, int edge) {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
10 this.s1 = s1;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
11 this.s2 = s2;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
12 this.edge = edge;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
13 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
14
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
15
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
16 #region IEquatable implementation
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
17 public bool Equals(AutomatonTransition other) {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
18 return other.s1 == s1 && other.s2 == s2 && other.edge == edge ;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
19 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
20 #endregion
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
21
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
22 public override bool Equals(object obj) {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
23 if (obj is AutomatonTransition)
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
24 return Equals((AutomatonTransition)obj);
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
25 return base.Equals(obj);
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
26 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
27
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
28 public override int GetHashCode() {
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
29 return s1 + s2 + edge;
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
30 }
205
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
31
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
32 public static bool operator == (AutomatonTransition rv, AutomatonTransition lv) {
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
33 return rv.Equals(lv);
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
34 }
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
35
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
36 public static bool operator !=(AutomatonTransition rv, AutomatonTransition lv) {
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
37 return rv.Equals(lv);
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 166
diff changeset
38 }
162
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
39 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
40 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
41