annotate Implab/Automaton/AutomatonTransition.cs @ 187:dd4a3590f9c6 ref20160224

Reworked cancelation handling, if the cancel handler isn't specified the OperationCanceledException will be handled by the error handler Any unhandled OperationCanceledException will cause the promise cancelation
author cin
date Tue, 19 Apr 2016 17:35:20 +0300
parents b84cdbe82e7f
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