diff options
Diffstat (limited to 'java/src/main/java/org/whispersystems/libaxolotl/AxolotlAddress.java')
-rw-r--r-- | java/src/main/java/org/whispersystems/libaxolotl/AxolotlAddress.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/java/src/main/java/org/whispersystems/libaxolotl/AxolotlAddress.java b/java/src/main/java/org/whispersystems/libaxolotl/AxolotlAddress.java new file mode 100644 index 00000000..9d0476c0 --- /dev/null +++ b/java/src/main/java/org/whispersystems/libaxolotl/AxolotlAddress.java @@ -0,0 +1,39 @@ +package org.whispersystems.libaxolotl; + +public class AxolotlAddress { + + private final String name; + private final int deviceId; + + public AxolotlAddress(String name, int deviceId) { + this.name = name; + this.deviceId = deviceId; + } + + public String getName() { + return name; + } + + public int getDeviceId() { + return deviceId; + } + + @Override + public String toString() { + return name + ":" + deviceId; + } + + @Override + public boolean equals(Object other) { + if (other == null) return false; + if (!(other instanceof AxolotlAddress)) return false; + + AxolotlAddress that = (AxolotlAddress)other; + return this.name.equals(that.name) && this.deviceId == that.deviceId; + } + + @Override + public int hashCode() { + return this.name.hashCode() ^ this.deviceId; + } +} |