diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-11-19 16:49:55 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-11-19 16:53:50 +0100 |
commit | 025248c5690e1f1c5189d53e80d302b1d7369542 (patch) | |
tree | e157d0f5c1b3a12670710f03a73a5b938c963169 /document | |
parent | 06ae58f434aa7a513259f43d3fa932bcc513682c (diff) |
Override equals()/hashCode() for TensorDataType
Diffstat (limited to 'document')
-rw-r--r-- | document/abi-spec.json | 2 | ||||
-rw-r--r-- | document/src/main/java/com/yahoo/document/TensorDataType.java | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/document/abi-spec.json b/document/abi-spec.json index b119f9991b3..903b7a897df 100644 --- a/document/abi-spec.json +++ b/document/abi-spec.json @@ -1911,6 +1911,8 @@ "public java.lang.Class getValueClass()", "public boolean isValueCompatible(com.yahoo.document.datatypes.FieldValue)", "public com.yahoo.tensor.TensorType getTensorType()", + "public boolean equals(java.lang.Object)", + "public int hashCode()", "public bridge synthetic com.yahoo.document.DataType clone()", "public bridge synthetic com.yahoo.vespa.objects.Identifiable clone()", "public bridge synthetic java.lang.Object clone()" diff --git a/document/src/main/java/com/yahoo/document/TensorDataType.java b/document/src/main/java/com/yahoo/document/TensorDataType.java index a9624e96b16..c4fdff30f8b 100644 --- a/document/src/main/java/com/yahoo/document/TensorDataType.java +++ b/document/src/main/java/com/yahoo/document/TensorDataType.java @@ -6,6 +6,8 @@ import com.yahoo.document.datatypes.TensorFieldValue; import com.yahoo.tensor.TensorType; import com.yahoo.vespa.objects.Ids; +import java.util.Objects; + /** * A DataType containing a tensor type * @@ -49,4 +51,17 @@ public class TensorDataType extends DataType { /** Returns the type of the tensor this field can hold */ public TensorType getTensorType() { return tensorType; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + TensorDataType that = (TensorDataType) o; + return Objects.equals(tensorType, that.tensorType); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), tensorType); + } } |