Skip to content

Commit

Permalink
Hashcode and equals fix for simple property
Browse files Browse the repository at this point in the history
  • Loading branch information
BrynCooke committed May 7, 2015
1 parent 0805009 commit 795d7b0
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.thinkaurelius.titan.core.TitanProperty;
import com.thinkaurelius.titan.graphdb.internal.InternalRelation;
import com.thinkaurelius.titan.graphdb.internal.InternalRelationType;
import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
import org.apache.commons.lang3.builder.HashCodeBuilder;

Expand Down Expand Up @@ -59,16 +60,12 @@ public String toString() {

@Override
public int hashCode() {
return new HashCodeBuilder().append(relation).append(key).append(value).toHashCode();
return ElementHelper.hashCode(this);
}

@Override
public boolean equals(Object oth) {
if (this==oth) return true;
else if (oth==null || !getClass().isInstance(oth)) return false;
SimpleTitanProperty other = (SimpleTitanProperty)oth;
return relation.equals(other.relation) && key.equals(other.key) &&
value.equals(other.value);
return ElementHelper.areEqual(this, oth);
}

}

0 comments on commit 795d7b0

Please sign in to comment.