Mercurial > pub > ImplabNet
diff Implab/Automaton/AutomatonTransition.cs @ 162:0526412bbb26 ref20160224
DFA refactoring
author | cin |
---|---|
date | Wed, 24 Feb 2016 08:39:53 +0300 |
parents | |
children | b84cdbe82e7f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Implab/Automaton/AutomatonTransition.cs Wed Feb 24 08:39:53 2016 +0300 @@ -0,0 +1,33 @@ +using System; + +namespace Implab.Automaton { + struct AutomatonTransition : IEquatable<AutomatonTransition> { + public readonly int s1; + public readonly int s2; + public readonly int edge; + + public AutomatonTransition(int s1, int s2, int edge) { + this.s1 = s1; + this.s2 = s2; + this.edge = edge; + } + + + #region IEquatable implementation + public bool Equals(AutomatonTransition other) { + return other.s1 == s1 && other.s2 == s2 && other.edge == edge ; + } + #endregion + + public override bool Equals(object obj) { + if (obj is AutomatonTransition) + return Equals((AutomatonTransition)obj); + return base.Equals(obj); + } + + public override int GetHashCode() { + return s1 + s2 + edge; + } + } +} +