This is an automated email from the ASF dual-hosted git repository.
jermy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new c128b4a25 fix checkstyle equals and hashcode issue (#1856)
c128b4a25 is described below
commit c128b4a25cb5b4002a3be8ccdf263010027a6266
Author: seagle <[email protected]>
AuthorDate: Sat May 7 19:47:00 2022 +0800
fix checkstyle equals and hashcode issue (#1856)
---
.../java/com/baidu/hugegraph/auth/RolePermission.java | 4 ++++
.../java/com/baidu/hugegraph/backend/cache/RamCache.java | 4 ++++
.../hugegraph/backend/serializer/BinaryBackendEntry.java | 4 ++++
.../hugegraph/backend/serializer/TextBackendEntry.java | 5 +++++
.../com/baidu/hugegraph/structure/HugeEdgeProperty.java | 4 ++++
.../baidu/hugegraph/traversal/optimize/HugeCountStep.java | 14 ++++++++++++++
.../baidu/hugegraph/traversal/optimize/HugeGraphStep.java | 15 +++++++++++++++
.../hugegraph/traversal/optimize/HugeVertexStep.java | 15 +++++++++++++++
8 files changed, 65 insertions(+)
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RolePermission.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RolePermission.java
index 4d52986a5..1c35b7e8f 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RolePermission.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/auth/RolePermission.java
@@ -135,6 +135,10 @@ public class RolePermission {
return Objects.equals(this.roles, other.roles);
}
+ public int hashCode() {
+ return Objects.hash(this.roles);
+ }
+
@Override
public String toString() {
return this.roles.toString();
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/RamCache.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/RamCache.java
index 0bfda706d..d4c55d4d2 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/RamCache.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/RamCache.java
@@ -252,6 +252,10 @@ public class RamCache extends AbstractCache<Id, Object> {
LinkNode<K, V> other = (LinkNode<K, V>) obj;
return this.key().equals(other.key());
}
+
+ public int hashCode() {
+ return this.key().hashCode();
+ }
}
private static final class LinkedQueueNonBigLock<K, V> {
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryBackendEntry.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryBackendEntry.java
index e3126dbe8..b540296b8 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryBackendEntry.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/BinaryBackendEntry.java
@@ -197,6 +197,10 @@ public class BinaryBackendEntry implements BackendEntry {
return this.columns.containsAll(other.columns);
}
+ public int hashCode() {
+ return this.id().hashCode() ^ this.columns.size();
+ }
+
protected static final class BinaryId implements Id {
private final byte[] bytes;
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/TextBackendEntry.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/TextBackendEntry.java
index 8e764a29b..8f313d93c 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/TextBackendEntry.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/serializer/TextBackendEntry.java
@@ -358,6 +358,7 @@ public class TextBackendEntry implements BackendEntry,
Cloneable {
if (this.columns().size() != other.columns().size()) {
return false;
}
+
for (Map.Entry<String, String> e : this.columns.entrySet()) {
String key = e.getKey();
String value = e.getValue();
@@ -371,4 +372,8 @@ public class TextBackendEntry implements BackendEntry,
Cloneable {
}
return true;
}
+
+ public int hashCode() {
+ return this.id().hashCode() ^ this.columns().hashCode();
+ }
}
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeEdgeProperty.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeEdgeProperty.java
index 00c234b66..c19152bae 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeEdgeProperty.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/structure/HugeEdgeProperty.java
@@ -63,6 +63,10 @@ public class HugeEdgeProperty<V> extends HugeProperty<V> {
return ElementHelper.areEqual(this, obj);
}
+ public int hashCode() {
+ return ElementHelper.hashCode(this);
+ }
+
public HugeEdgeProperty<V> switchEdgeOwner() {
assert this.owner instanceof HugeEdge;
return new HugeEdgeProperty<V>(((HugeEdge) this.owner).switchOwner(),
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStep.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStep.java
index c23a22c01..d13cc17f2 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStep.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeCountStep.java
@@ -46,6 +46,20 @@ public final class HugeCountStep<S extends Element>
this.originGraphStep = originGraphStep;
}
+ public boolean equals(Object obj) {
+ if (!(obj instanceof HugeCountStep)) {
+ return false;
+ }
+
+ if (!super.equals(obj)) {
+ return false;
+ }
+
+ HugeCountStep other = (HugeCountStep) obj;
+ return Objects.equals(this.originGraphStep,
+ other.originGraphStep) && this.done ==
other.done;
+ }
+
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), this.originGraphStep, this.done);
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeGraphStep.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeGraphStep.java
index 41f5a0742..6ec98aa43 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeGraphStep.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeGraphStep.java
@@ -198,6 +198,21 @@ public final class HugeGraphStep<S, E extends Element>
return this.lastTimeResults;
}
+ public boolean equals(Object obj) {
+ if (!(obj instanceof HugeGraphStep)) {
+ return false;
+ }
+
+ if (!super.equals(obj)) {
+ return false;
+ }
+
+ HugeGraphStep other = (HugeGraphStep) obj;
+ return this.hasContainers.equals(other.hasContainers) &&
+ this.queryInfo.equals(other.queryInfo) &&
+ this.lastTimeResults.equals(other.lastTimeResults);
+ }
+
@Override
public int hashCode() {
return super.hashCode() ^
diff --git
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeVertexStep.java
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeVertexStep.java
index 2468c1f40..17d5c645c 100644
---
a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeVertexStep.java
+++
b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/HugeVertexStep.java
@@ -231,6 +231,21 @@ public class HugeVertexStep<E extends Element>
return this.iterator;
}
+ public boolean equals(Object obj) {
+ if (!(obj instanceof HugeVertexStep)) {
+ return false;
+ }
+
+ if (!super.equals(obj)) {
+ return false;
+ }
+
+ HugeVertexStep other = (HugeVertexStep) obj;
+ return this.hasContainers.equals(other.hasContainers) &&
+ this.queryInfo.equals(other.queryInfo) &&
+ this.iterator.equals(other.iterator);
+ }
+
@Override
public int hashCode() {
return super.hashCode() ^