Showing
2 changed files
with
5 additions
and
4 deletions
| ... | @@ -41,7 +41,7 @@ public final class HostToHostIntent extends ConnectivityIntent { | ... | @@ -41,7 +41,7 @@ public final class HostToHostIntent extends ConnectivityIntent { |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | private static HostId max(HostId one, HostId two) { | 43 | private static HostId max(HostId one, HostId two) { |
| 44 | - return one.hashCode() > two.hashCode() ? one : two; | 44 | + return one.hashCode() >= two.hashCode() ? one : two; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | /** | 47 | /** | ... | ... |
| ... | @@ -37,8 +37,8 @@ public abstract class Intent implements BatchOperationTarget { | ... | @@ -37,8 +37,8 @@ public abstract class Intent implements BatchOperationTarget { |
| 37 | */ | 37 | */ |
| 38 | protected Intent(IntentId id, ApplicationId appId, | 38 | protected Intent(IntentId id, ApplicationId appId, |
| 39 | Collection<NetworkResource> resources) { | 39 | Collection<NetworkResource> resources) { |
| 40 | + this.id = checkNotNull(id, "Intent ID cannot be null"); | ||
| 40 | this.appId = checkNotNull(appId, "Application ID cannot be null"); | 41 | this.appId = checkNotNull(appId, "Application ID cannot be null"); |
| 41 | - this.id = checkNotNull(id, "Fingerprint cannot be null"); | ||
| 42 | this.resources = resources; | 42 | this.resources = resources; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| ... | @@ -77,6 +77,7 @@ public abstract class Intent implements BatchOperationTarget { | ... | @@ -77,6 +77,7 @@ public abstract class Intent implements BatchOperationTarget { |
| 77 | * @return intent identifier | 77 | * @return intent identifier |
| 78 | */ | 78 | */ |
| 79 | protected static IntentId id(Object... fields) { | 79 | protected static IntentId id(Object... fields) { |
| 80 | + // FIXME: spread the bits across the full long spectrum | ||
| 80 | return IntentId.valueOf(Objects.hash(fields)); | 81 | return IntentId.valueOf(Objects.hash(fields)); |
| 81 | } | 82 | } |
| 82 | 83 | ||
| ... | @@ -90,12 +91,12 @@ public abstract class Intent implements BatchOperationTarget { | ... | @@ -90,12 +91,12 @@ public abstract class Intent implements BatchOperationTarget { |
| 90 | } | 91 | } |
| 91 | 92 | ||
| 92 | @Override | 93 | @Override |
| 93 | - public int hashCode() { | 94 | + public final int hashCode() { |
| 94 | return Objects.hash(id); | 95 | return Objects.hash(id); |
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | @Override | 98 | @Override |
| 98 | - public boolean equals(Object obj) { | 99 | + public final boolean equals(Object obj) { |
| 99 | if (this == obj) { | 100 | if (this == obj) { |
| 100 | return true; | 101 | return true; |
| 101 | } | 102 | } | ... | ... |
-
Please register or login to post a comment