You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/04/09 19:28:12 UTC
[2/6] incubator-tinkerpop git commit: ReferenceXXX connected to
Traverser as the detach()/attach() model. So much less data. Will review with
@spmallette tomorrow.
ReferenceXXX connected to Traverser as the detach()/attach() model. So much less data. Will review with @spmallette tomorrow.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/7c8e38cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/7c8e38cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/7c8e38cc
Branch: refs/heads/master
Commit: 7c8e38cc2b82a283f024b1b55f8c02fc23188b1c
Parents: 4858071
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Apr 8 18:32:10 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Apr 8 18:32:10 2015 -0600
----------------------------------------------------------------------
.../traverser/util/AbstractTraverser.java | 18 +++----
.../gremlin/structure/io/gryo/GryoMapper.java | 13 ++++-
.../structure/util/reference/ReferenceEdge.java | 29 ++++-------
.../util/reference/ReferenceElement.java | 29 ++++-------
.../util/reference/ReferenceProperty.java | 32 +++++-------
.../util/reference/ReferenceVertex.java | 55 +++++---------------
.../util/reference/ReferenceVertexProperty.java | 49 ++++-------------
.../gremlin/structure/util/star/StarGraph.java | 21 ++------
8 files changed, 79 insertions(+), 167 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/AbstractTraverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/AbstractTraverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/AbstractTraverser.java
index 6804dbd..cb86070 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/AbstractTraverser.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/AbstractTraverser.java
@@ -22,12 +22,12 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversalSideEffects;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyPath;
+import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversalSideEffects;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedElement;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
-import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceElement;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceProperty;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -103,16 +103,16 @@ public abstract class AbstractTraverser<T> implements Traverser<T>, Traverser.Ad
@Override
public Admin<T> detach() {
- this.t = DetachedFactory.detach(this.t, false);
+ this.t = ReferenceFactory.detach(this.t);
return this;
}
@Override
public Admin<T> attach(final Vertex hostVertex) {
- if (this.t instanceof DetachedElement)
- this.t = (T) ((DetachedElement) this.t).attach(hostVertex);
- else if (this.t instanceof DetachedProperty)
- this.t = (T) ((DetachedProperty) this.t).attach(hostVertex);
+ if (this.t instanceof ReferenceElement)
+ this.t = (T) ((ReferenceElement) this.t).attach(hostVertex);
+ else if (this.t instanceof ReferenceProperty)
+ this.t = (T) ((ReferenceProperty) this.t).attach(hostVertex);
// you do not want to attach a path because it will reference graph objects not at the current vertex
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index 1aa4604..2a74661 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -44,6 +44,11 @@ import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedPath;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedProperty;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferencePath;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceProperty;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty;
import org.apache.tinkerpop.shaded.kryo.Kryo;
import org.apache.tinkerpop.shaded.kryo.KryoSerializable;
import org.apache.tinkerpop.shaded.kryo.Serializer;
@@ -289,6 +294,12 @@ public final class GryoMapper implements Mapper<Kryo> {
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(URI.class, kryo -> new URISerializer(), 72));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(VertexTerminator.class, null, 13));
+ add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferenceEdge.class, null, 81));
+ add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferenceVertexProperty.class, null, 82));
+ add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferenceProperty.class, null, 83));
+ add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferenceVertex.class, null, 84));
+ add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ReferencePath.class, null, 85)); // ***LAST ID**
+
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Edge.class, kryo -> new GraphSerializer.EdgeSerializer(), 65));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Vertex.class, kryo -> new GraphSerializer.VertexSerializer(), 66));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Property.class, kryo -> new GraphSerializer.PropertySerializer(), 67));
@@ -310,7 +321,7 @@ public final class GryoMapper implements Mapper<Kryo> {
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapMemory.class, null, 73));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapReduce.NullObject.class, null, 74));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(AtomicLong.class, null, 79));
- add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DependantMutableMetrics.class, null, 80)); // ***LAST ID**
+ add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DependantMutableMetrics.class, null, 80));
}};
private static final byte major = 1;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
index 842039d..75d4b60 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceEdge.java
@@ -24,40 +24,27 @@ package org.apache.tinkerpop.gremlin.structure.util.reference;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import java.util.Collections;
import java.util.Iterator;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class ReferenceEdge extends ReferenceElement<Edge> implements Edge {
+public class ReferenceEdge extends ReferenceElement<Edge> {
- public ReferenceEdge(final Edge edge) {
- super(edge);
+ private ReferenceEdge() {
+ super();
}
- @Override
- public Iterator<Vertex> vertices(Direction direction) {
- return Collections.emptyIterator();
- }
-
- @Override
- public void remove() {
- throw Edge.Exceptions.edgeRemovalNotSupported();
- }
-
- @Override
- public <V> Iterator<Property<V>> properties(final String... propertyKeys) {
- return Collections.emptyIterator();
+ public ReferenceEdge(final Edge edge) {
+ super(edge);
}
@Override
public Edge attach(final Vertex hostVertex) {
- final Iterator<Edge> edges = IteratorUtils.filter(hostVertex.edges(Direction.OUT), edge -> edge.equals(this));
+ final Iterator<Edge> edges = IteratorUtils.filter(hostVertex.edges(Direction.OUT), edge -> edge.id().equals(this.id));
if (!edges.hasNext())
throw new IllegalStateException("The reference edge could not be found incident to the provided vertex: " + this);
return edges.next();
@@ -71,5 +58,9 @@ public class ReferenceEdge extends ReferenceElement<Edge> implements Edge {
return edges.next();
}
+ @Override
+ public String toString() {
+ return "e*[" + this.id + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
index 2fce123..1a179e4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceElement.java
@@ -22,43 +22,32 @@
package org.apache.tinkerpop.gremlin.structure.util.reference;
import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.util.detached.Attachable;
-import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
import java.io.Serializable;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public abstract class ReferenceElement<E extends Element> implements Element, Serializable, Attachable<E> {
+public abstract class ReferenceElement<E extends Element> implements Serializable, Attachable<E> {
- private static final String EMPTY_STRING = "";
+ protected Object id;
- protected final Object id;
+ protected ReferenceElement() {
+ this.id = null;
+ }
public ReferenceElement(final Element element) {
this.id = element.id();
}
@Override
- public Object id() {
- return this.id;
- }
-
- @Override
- public String label() {
- return EMPTY_STRING;
- }
-
- @Override
- public Graph graph() {
- return EmptyGraph.instance();
+ public int hashCode() {
+ return this.id.hashCode();
}
@Override
- public <V> Property<V> property(final String key, final V value) {
- throw Element.Exceptions.propertyAdditionNotSupported();
+ public boolean equals(final Object object) {
+ return object instanceof ReferenceElement && this.id.equals(((ReferenceElement) object).id);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceProperty.java
index fdac259..a0afa35 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceProperty.java
@@ -21,24 +21,26 @@
package org.apache.tinkerpop.gremlin.structure.util.reference;
-import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.util.detached.Attachable;
import java.io.Serializable;
-import java.util.NoSuchElementException;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class ReferenceProperty<V> implements Property, Attachable<Property<V>>, Serializable {
+public class ReferenceProperty<V> implements Attachable<Property<V>>, Serializable {
private ReferenceElement<?> element;
private String key;
- public ReferenceProperty(final String key,final ReferenceElement<?> element) {
+ private ReferenceProperty() {
+
+ }
+
+ public ReferenceProperty(final String key, final ReferenceElement<?> element) {
this.element = element;
this.key = key;
}
@@ -54,27 +56,17 @@ public class ReferenceProperty<V> implements Property, Attachable<Property<V>>,
}
@Override
- public String key() {
- return this.key;
- }
-
- @Override
- public Object value() throws NoSuchElementException {
- return null;
- }
-
- @Override
- public boolean isPresent() {
- return false;
+ public int hashCode() {
+ return this.element.hashCode() + this.key.hashCode();
}
@Override
- public Element element() {
- return this.element;
+ public boolean equals(final Object object) {
+ return object instanceof ReferenceProperty && object.hashCode() == this.hashCode();
}
@Override
- public void remove() {
- throw Element.Exceptions.propertyRemovalNotSupported();
+ public String toString() {
+ return "p*[" + this.element.id + ":" + this.key + "]";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertex.java
index b2293ce..49c4d33 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertex.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertex.java
@@ -21,63 +21,29 @@
package org.apache.tinkerpop.gremlin.structure.util.reference;
-import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Edge;
-import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
import java.util.Collections;
-import java.util.Iterator;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class ReferenceVertex extends ReferenceElement<Vertex> implements Vertex {
+public class ReferenceVertex extends ReferenceElement<Vertex> {
- public ReferenceVertex(final Vertex vertex) {
- super(vertex);
- }
-
- @Override
- public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
- throw Vertex.Exceptions.edgeAdditionsNotSupported();
- }
-
- @Override
- public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) {
- throw Element.Exceptions.propertyAdditionNotSupported();
- }
-
- @Override
- public Iterator<Edge> edges(final Direction direction, final String... edgeLabels) {
- return Collections.emptyIterator();
- }
-
- @Override
- public Iterator<Vertex> vertices(final Direction direction, final String... edgeLabels) {
- return Collections.emptyIterator();
- }
-
- @Override
- public void remove() {
- throw Vertex.Exceptions.vertexRemovalNotSupported();
- }
-
- @Override
- public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) {
- return Collections.emptyIterator();
+ private ReferenceVertex() {
+ super();
}
- @Override
- public <V> VertexProperty<V> property(final String key, final V value) {
- throw Element.Exceptions.propertyAdditionNotSupported();
+ public ReferenceVertex(final Vertex vertex) {
+ super(vertex);
}
@Override
public Vertex attach(final Vertex hostVertex) {
- if (hostVertex.equals(this))
+ if (hostVertex.id().equals(this.id))
return hostVertex;
else
throw new IllegalStateException("The host vertex must be the reference vertex to attach: " + this + "!=" + hostVertex);
@@ -87,4 +53,9 @@ public class ReferenceVertex extends ReferenceElement<Vertex> implements Vertex
public Vertex attach(final Graph hostGraph) {
return hostGraph.vertices(this.id).next();
}
+
+ @Override
+ public String toString() {
+ return "v*[" + this.id + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
index 01e25ff..36128f8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceVertexProperty.java
@@ -21,61 +21,29 @@
package org.apache.tinkerpop.gremlin.structure.util.reference;
-import org.apache.tinkerpop.gremlin.process.traversal.FastNoSuchElementException;
-import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
-import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import java.util.Collections;
import java.util.Iterator;
-import java.util.NoSuchElementException;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty> implements VertexProperty<V> {
+public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty> {
- public ReferenceVertexProperty(final VertexProperty vertexProperty) {
- super(vertexProperty);
- }
-
- @Override
- public String key() {
- return null;
- }
-
- @Override
- public V value() throws NoSuchElementException {
- throw FastNoSuchElementException.instance();
- }
-
- @Override
- public boolean isPresent() {
- return false;
+ private ReferenceVertexProperty() {
+ super();
}
- @Override
- public Vertex element() {
- return null;
- }
-
- @Override
- public void remove() {
- throw Element.Exceptions.propertyRemovalNotSupported();
- }
-
- @Override
- public <U> Iterator<Property<U>> properties(String... propertyKeys) {
- return Collections.emptyIterator();
+ public ReferenceVertexProperty(final VertexProperty vertexProperty) {
+ super(vertexProperty);
}
@Override
public VertexProperty<V> attach(final Vertex hostVertex) {
- final Iterator<VertexProperty<V>> vertexPropertyIterator = IteratorUtils.filter(hostVertex.<V>properties(), vp -> ElementHelper.areEqual(this, vp));
+ final Iterator<VertexProperty<V>> vertexPropertyIterator = IteratorUtils.filter(hostVertex.<V>properties(), vp -> vp.id().equals(this.id));
if (!vertexPropertyIterator.hasNext())
throw new IllegalStateException("The reference vertex property could not be be found at the provided vertex: " + this);
return vertexPropertyIterator.next();
@@ -85,4 +53,9 @@ public class ReferenceVertexProperty<V> extends ReferenceElement<VertexProperty>
public VertexProperty<V> attach(final Graph hostGraph) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String toString() {
+ return "vp*[" + this.id + "]";
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7c8e38cc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
index 0af926f..df414d7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
@@ -414,13 +414,8 @@ public final class StarGraph implements Graph {
}
@Override
- public boolean equals(final Object other) {
- return ElementHelper.areEqual(this, other);
- }
-
- @Override
- public int hashCode() {
- return ElementHelper.hashCode((Element) this);
+ public String toString() {
+ return StringFactory.propertyString(this);
}
}
@@ -439,7 +434,7 @@ public final class StarGraph implements Graph {
@Override
public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
- if (!ElementHelper.areEqual(starVertex, inVertex))
+ if (!starVertex.equals(inVertex))
throw new IllegalStateException("An adjacent vertex can only connect to the star vertex: " + starVertex);
return starVertex.addInEdge(label, this, keyValues);
}
@@ -562,16 +557,6 @@ public final class StarGraph implements Graph {
}
@Override
- public boolean equals(final Object other) {
- return ElementHelper.areEqual(this, other);
- }
-
- @Override
- public int hashCode() {
- return ElementHelper.hashCode(this);
- }
-
- @Override
public String toString() {
return StringFactory.edgeString(this);
}