Mercurial > pub > ImplabNet
annotate Implab/Automaton/AutomatonTransition.cs @ 210:5dc21f6a3222 v2
Code review for RunnableComponent
Added StaApartment class based on System.Windows.Forms.Application message loop
author | cin |
---|---|
date | Mon, 20 Mar 2017 17:44:18 +0300 |
parents | 8200ab154c8a |
children | d6fe09f5592c |
rev | line source |
---|---|
162 | 1 using System; |
2 | |
3 namespace Implab.Automaton { | |
166 | 4 public struct AutomatonTransition : IEquatable<AutomatonTransition> { |
162 | 5 public readonly int s1; |
6 public readonly int s2; | |
7 public readonly int edge; | |
8 | |
9 public AutomatonTransition(int s1, int s2, int edge) { | |
10 this.s1 = s1; | |
11 this.s2 = s2; | |
12 this.edge = edge; | |
13 } | |
14 | |
15 | |
16 #region IEquatable implementation | |
17 public bool Equals(AutomatonTransition other) { | |
18 return other.s1 == s1 && other.s2 == s2 && other.edge == edge ; | |
19 } | |
20 #endregion | |
21 | |
22 public override bool Equals(object obj) { | |
23 if (obj is AutomatonTransition) | |
24 return Equals((AutomatonTransition)obj); | |
25 return base.Equals(obj); | |
26 } | |
27 | |
28 public override int GetHashCode() { | |
29 return s1 + s2 + edge; | |
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 | 39 } |
40 } | |
41 |