This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/master by this push: new b5038ae Implement equals and hashcode for unsigned wrappers. b5038ae is described below commit b5038ae2bc8a101833770c92a0d79cc29640337f Author: Sebastian Rühl <sru...@apache.org> AuthorDate: Fri Feb 16 23:36:28 2018 +0100 Implement equals and hashcode for unsigned wrappers. --- .../java/ads/api/util/UnsignedIntLEByteValue.java | 18 ++++++++++++++++++ .../java/ads/api/util/UnsignedShortLEByteValue.java | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java index 4ba9ace..59c865b 100644 --- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java +++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedIntLEByteValue.java @@ -63,6 +63,24 @@ public abstract class UnsignedIntLEByteValue extends ByteValue { } @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof UnsignedIntLEByteValue)) return false; + if (!super.equals(o)) return false; + + UnsignedIntLEByteValue that = (UnsignedIntLEByteValue) o; + + return longValue == that.longValue; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (int) (longValue ^ (longValue >>> 32)); + return result; + } + + @Override public String toString() { return String.valueOf(getAsLong()); } diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java index d6b65bf..bfc16bf 100644 --- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java +++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/util/UnsignedShortLEByteValue.java @@ -61,6 +61,24 @@ public abstract class UnsignedShortLEByteValue extends ByteValue { } @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof UnsignedShortLEByteValue)) return false; + if (!super.equals(o)) return false; + + UnsignedShortLEByteValue that = (UnsignedShortLEByteValue) o; + + return intValue == that.intValue; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + intValue; + return result; + } + + @Override public String toString() { return getClass().getSimpleName() + "{" + "intValue=" + getAsInt() + -- To stop receiving notification emails like this one, please contact sru...@apache.org.