using System; namespace StatementMachineService.Model { public class SignalState : IComparable { public SignalState(string name) { this.Name = name; } public string Name { get; private set; } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != this.GetType()) { return false; } return this.Equals((SignalState)obj); } public override int GetHashCode() { return this.Name != null ? this.Name.GetHashCode() : 0; } public int CompareTo(object obj) { throw new InvalidOperationException("state machine should not use CompareTo"); } protected bool Equals(SignalState other) { return string.Equals(this.Name, other.Name); } } }