Skip to content

Commit

Permalink
fix checkstyle equals and hashcode issue (#1856)
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle-yuan authored May 7, 2022
1 parent 2e313e0 commit c128b4a
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ public boolean equals(Object object) {
return Objects.equals(this.roles, other.roles);
}

public int hashCode() {
return Objects.hash(this.roles);
}

@Override
public String toString() {
return this.roles.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ public boolean equals(Object obj) {
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> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ public boolean equals(Object obj) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ public boolean equals(Object obj) {
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();
Expand All @@ -371,4 +372,8 @@ public boolean equals(Object obj) {
}
return true;
}

public int hashCode() {
return this.id().hashCode() ^ this.columns().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public boolean equals(Object obj) {
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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ public HugeCountStep(final Traversal.Admin<?, ?> traversal,
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ public Iterator<?> lastTimeResults() {
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() ^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,21 @@ public Iterator<?> lastTimeResults() {
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() ^
Expand Down

0 comments on commit c128b4a

Please sign in to comment.