annotate Implab/Automaton/AutomatonTransition.cs @ 166:b84cdbe82e7f ref20160224

sync
author cin
date Mon, 29 Feb 2016 18:41:01 +0300
parents 0526412bbb26
children 8200ab154c8a
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 {
166
cin
parents: 162
diff changeset
4 public struct 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 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
31 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
32 }
0526412bbb26 DFA refactoring
cin
parents:
diff changeset
33