Mercurial > pub > ImplabNet
annotate Implab/Automaton/AutomatonTransition.cs @ 244:eee3e49dd1ff v3
working on promises
author | cin |
---|---|
date | Thu, 25 Jan 2018 19:09:16 +0300 |
parents | d6fe09f5592c |
children |
rev | line source |
---|---|
162 | 1 using System; |
2 | |
3 namespace Implab.Automaton { | |
233 | 4 public class 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 |