SingalEvent.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. namespace StatementMachineService.Model
  3. {
  4. public class SingalEvent:IComparable
  5. {
  6. public SingalEvent(int identifier)
  7. {
  8. this.Identifier = identifier;
  9. }
  10. public int Identifier { get; set; }
  11. public override bool Equals(object obj)
  12. {
  13. if (ReferenceEquals(null, obj))
  14. {
  15. return false;
  16. }
  17. if (ReferenceEquals(this, obj))
  18. {
  19. return true;
  20. }
  21. if (obj.GetType() != GetType())
  22. {
  23. return false;
  24. }
  25. return this.Equals((SingalEvent)obj);
  26. }
  27. public override int GetHashCode()
  28. {
  29. return this.Identifier;
  30. }
  31. public int CompareTo(object obj)
  32. {
  33. throw new InvalidOperationException("state machine should not use CompareTo");
  34. }
  35. protected bool Equals(SingalEvent other)
  36. {
  37. return this.Identifier == other.Identifier;
  38. }
  39. }
  40. }