Mercurial > pub > ImplabNet
annotate Implab/Automaton/AutomatonTransition.cs @ 221:8808383fcb94 v2
fixed recursion in Safe.Dispose with IEnumerable
| author | cin |
|---|---|
| date | Fri, 23 Jun 2017 01:03:42 +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 |
