com.wallstop-studios.dxmessaging 2.0.0-rc05 → 2.0.0-rc07

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,29 +3,88 @@
3
3
  using System;
4
4
  using System.Threading;
5
5
 
6
- public readonly struct MessageRegistrationHandle : IEquatable<MessageRegistrationHandle>, IComparable<MessageRegistrationHandle>
6
+ public readonly struct MessageRegistrationHandle
7
+ : IEquatable<MessageRegistrationHandle>,
8
+ IComparable<MessageRegistrationHandle>,
9
+ IComparable
7
10
  {
8
11
  private static long StaticIdCount;
9
12
 
10
- private readonly Guid _handle;
11
13
  private readonly long _id;
12
14
  private readonly int _hashCode;
13
15
 
14
16
  public static MessageRegistrationHandle CreateMessageRegistrationHandle()
15
17
  {
16
- return new MessageRegistrationHandle(Guid.NewGuid(), Interlocked.Increment(ref StaticIdCount));
18
+ return new MessageRegistrationHandle(Interlocked.Increment(ref StaticIdCount));
17
19
  }
18
20
 
19
- private MessageRegistrationHandle(Guid handle, long id)
21
+ private MessageRegistrationHandle(long id)
20
22
  {
21
- _handle = handle;
22
23
  _id = id;
23
- _hashCode = _handle.GetHashCode();
24
+ _hashCode = _id.GetHashCode();
24
25
  }
25
26
 
26
- public override int GetHashCode()
27
+ public static bool operator ==(
28
+ MessageRegistrationHandle left,
29
+ MessageRegistrationHandle right
30
+ )
27
31
  {
28
- return _hashCode;
32
+ return left.Equals(right);
33
+ }
34
+
35
+ public static bool operator !=(
36
+ MessageRegistrationHandle left,
37
+ MessageRegistrationHandle right
38
+ )
39
+ {
40
+ return !left.Equals(right);
41
+ }
42
+
43
+ public static bool operator >(
44
+ MessageRegistrationHandle left,
45
+ MessageRegistrationHandle right
46
+ )
47
+ {
48
+ return left.CompareTo(right) > 0;
49
+ }
50
+
51
+ public static bool operator <(
52
+ MessageRegistrationHandle left,
53
+ MessageRegistrationHandle right
54
+ )
55
+ {
56
+ return left.CompareTo(right) < 0;
57
+ }
58
+
59
+ public static bool operator <=(
60
+ MessageRegistrationHandle left,
61
+ MessageRegistrationHandle right
62
+ )
63
+ {
64
+ return left.CompareTo(right) <= 0;
65
+ }
66
+
67
+ public static bool operator >=(
68
+ MessageRegistrationHandle left,
69
+ MessageRegistrationHandle right
70
+ )
71
+ {
72
+ return left.CompareTo(right) >= 0;
73
+ }
74
+
75
+ public int CompareTo(MessageRegistrationHandle other)
76
+ {
77
+ return _id.CompareTo(other._id);
78
+ }
79
+
80
+ public int CompareTo(object obj)
81
+ {
82
+ if (obj is MessageRegistrationHandle handle)
83
+ {
84
+ return CompareTo(handle);
85
+ }
86
+
87
+ return -1;
29
88
  }
30
89
 
31
90
  public override bool Equals(object other)
@@ -35,21 +94,17 @@
35
94
 
36
95
  public bool Equals(MessageRegistrationHandle other)
37
96
  {
38
- return _id == other._id && _handle.Equals(other._handle);
97
+ return _id == other._id;
39
98
  }
40
99
 
41
- public int CompareTo(MessageRegistrationHandle other)
100
+ public override int GetHashCode()
42
101
  {
43
- return _id.CompareTo(other._id);
102
+ return _hashCode;
44
103
  }
45
104
 
46
105
  public override string ToString()
47
106
  {
48
- return new
49
- {
50
- Handle = _handle.ToString(),
51
- Id = _id,
52
- }.ToString();
107
+ return new { Id = _id }.ToString();
53
108
  }
54
109
  }
55
110
  }