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/03/09 20:13:04 UTC
[2/2] incubator-tinkerpop git commit: gutted Vertex.Iterators,
Edge.Iterators...
gutted Vertex.Iterators, Edge.Iterators...
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/2a723753
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/2a723753
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/2a723753
Branch: refs/heads/newapi
Commit: 2a7237530a85144efd0a51711d2f42c24cac2669
Parents: 69ac752
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Mar 9 13:13:00 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Mar 9 13:13:00 2015 -0600
----------------------------------------------------------------------
.../traversal/TraversalVertexProgram.java | 2 +-
.../computer/traversal/TraverserExecutor.java | 2 +-
.../computer/util/ComputerDataStrategy.java | 2 +-
.../process/graph/traversal/EdgeTraversal.java | 4 +-
.../graph/traversal/ElementTraversal.java | 8 +-
.../traversal/VertexPropertyTraversal.java | 4 +-
.../graph/traversal/VertexTraversal.java | 4 +-
.../traversal/step/map/EdgeOtherVertexStep.java | 7 +-
.../traversal/step/map/EdgeVertexStep.java | 2 +-
.../traversal/step/map/PropertiesStep.java | 4 +-
.../graph/traversal/step/map/VertexStep.java | 4 +-
.../step/sideEffect/SackElementValueStep.java | 2 +-
.../traversal/step/sideEffect/SubgraphStep.java | 8 +-
.../process/graph/util/HasContainer.java | 3 +-
.../tinkerpop/gremlin/structure/Edge.java | 46 ++++------
.../tinkerpop/gremlin/structure/Element.java | 34 +++-----
.../tinkerpop/gremlin/structure/Vertex.java | 60 +++++--------
.../gremlin/structure/VertexProperty.java | 18 +---
.../structure/io/graphml/GraphMLWriter.java | 8 +-
.../structure/io/graphson/GraphSONModule.java | 26 ++++--
.../structure/io/graphson/GraphSONReader.java | 10 +--
.../structure/io/graphson/GraphSONVertex.java | 6 +-
.../io/graphson/GraphSONVertexProperty.java | 6 +-
.../gremlin/structure/io/gryo/GryoReader.java | 10 +--
.../gremlin/structure/io/gryo/GryoWriter.java | 4 +-
.../structure/strategy/PartitionStrategy.java | 21 +++--
.../structure/strategy/StrategyEdge.java | 19 ++--
.../structure/strategy/StrategyVertex.java | 23 ++---
.../strategy/StrategyVertexProperty.java | 15 ++--
.../structure/strategy/SubgraphStrategy.java | 12 +--
.../gremlin/structure/util/ElementHelper.java | 8 +-
.../gremlin/structure/util/StringFactory.java | 5 +-
.../structure/util/batch/BatchGraph.java | 31 +++----
.../structure/util/detached/DetachedEdge.java | 23 ++---
.../util/detached/DetachedElement.java | 9 +-
.../structure/util/detached/DetachedVertex.java | 21 ++---
.../util/detached/DetachedVertexProperty.java | 16 ++--
.../util/empty/EmptyVertexProperty.java | 9 +-
.../tinkerpop/gremlin/AbstractGremlinSuite.java | 6 --
.../generator/AbstractGeneratorTest.java | 8 +-
.../computer/util/ComputerDataStrategyTest.java | 8 +-
.../traversal/step/sideEffect/SubgraphTest.java | 8 +-
.../tinkerpop/gremlin/structure/EdgeTest.java | 23 ++---
.../tinkerpop/gremlin/structure/GraphTest.java | 91 ++++++++++----------
.../strategy/SequenceStrategyTest.java | 41 ++++-----
.../structure/strategy/StrategyGraphTest.java | 58 ++++++-------
.../util/detached/DetachedEdgeTest.java | 53 ++++++------
.../detached/DetachedVertexPropertyTest.java | 10 +--
.../util/detached/DetachedVertexTest.java | 33 +++----
.../tinkergraph/structure/TinkerEdge.java | 13 +--
.../tinkergraph/structure/TinkerElement.java | 4 +-
.../tinkergraph/structure/TinkerVertex.java | 17 ++--
.../structure/TinkerVertexProperty.java | 14 +--
53 files changed, 383 insertions(+), 500 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
index edc1643..8aaf90b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
@@ -149,7 +149,7 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
final TraverserGenerator traverserGenerator = this.traversal.getTraverserGenerator();
final String future = startStep.getNextStep().getId();
boolean voteToHalt = true;
- final Iterator<? extends Element> starts = startStep.returnsVertices() ? IteratorUtils.of(vertex) : vertex.iterators().edgeIterator(Direction.OUT);
+ final Iterator<? extends Element> starts = startStep.returnsVertices() ? IteratorUtils.of(vertex) : vertex.edges(Direction.OUT);
while (starts.hasNext()) {
final Element start = starts.next();
if (ElementHelper.idExists(start.id(), startStep.getIds())) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
index 5a56b80..89f8932 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
@@ -94,7 +94,7 @@ public final class TraverserExecutor {
if (obj instanceof Vertex)
return (Vertex) obj;
else if (obj instanceof Edge)
- return ((Edge) obj).iterators().vertexIterator(Direction.OUT).next();
+ return ((Edge) obj).outVertex();
else if (obj instanceof Property)
obj = ((Property) obj).element();
else
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerDataStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerDataStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerDataStrategy.java
index b756c0b..08010b8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerDataStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/ComputerDataStrategy.java
@@ -55,7 +55,7 @@ public class ComputerDataStrategy implements GraphStrategy {
@Override
public <V> UnaryOperator<Function<String[], Iterator<V>>> getVertexIteratorsValueIteratorStrategy(final StrategyContext<StrategyVertex> ctx, final GraphStrategy strategyComposer) {
- return (f) -> (keys) -> IteratorUtils.map(ctx.getCurrent().iterators().<V>propertyIterator(keys), vertexProperty -> vertexProperty.value());
+ return (f) -> (keys) -> IteratorUtils.map(ctx.getCurrent().<V>properties(keys), vertexProperty -> vertexProperty.value());
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/EdgeTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/EdgeTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/EdgeTraversal.java
index e6d5a9a..fe677b8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/EdgeTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/EdgeTraversal.java
@@ -35,10 +35,10 @@ public interface EdgeTraversal extends ElementTraversal<Edge> {
return traversal.addStep(new StartStep<>(traversal, this));
}
- @Override
+ /*@Override
public default <E2> GraphTraversal<Edge, Property<E2>> properties(final String... propertyKeys) {
return (GraphTraversal) this.start().properties(propertyKeys);
- }
+ }*/
public default <E2> GraphTraversal<Edge, Map<String, Property<E2>>> propertyMap(final String... propertyKeys) {
return this.start().propertyMap(propertyKeys);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
index a02172c..b4544f4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
@@ -128,13 +128,13 @@ public abstract interface ElementTraversal<A extends Element> {
return this.start().order(scope);
}
- public default <E2> GraphTraversal<A, ? extends Property<E2>> properties(final String... propertyKeys) {
+ /*public default <E2> GraphTraversal<A, ? extends Property<E2>> properties(final String... propertyKeys) {
return this.start().properties(propertyKeys);
- }
+ }*/
- public default <E2> GraphTraversal<A, E2> values(final String... propertyKeys) {
+ /*public default <E2> GraphTraversal<A, E2> values(final String... propertyKeys) {
return this.start().values(propertyKeys);
- }
+ }*/
public default GraphTraversal<A, Path> path() {
return this.start().path();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexPropertyTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexPropertyTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexPropertyTraversal.java
index 3abaf33..2210ef3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexPropertyTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexPropertyTraversal.java
@@ -35,10 +35,10 @@ public interface VertexPropertyTraversal extends ElementTraversal<VertexProperty
return traversal.addStep(new StartStep<>(traversal, this));
}
- @Override
+ /*@Override
public default <E2> GraphTraversal<VertexProperty, Property<E2>> properties(final String... propertyKeys) {
return (GraphTraversal) this.start().properties(propertyKeys);
- }
+ }*/
public default <E2> GraphTraversal<VertexProperty, Map<String, Property<E2>>> propertyMap(final String... propertyKeys) {
return this.start().propertyMap(propertyKeys);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexTraversal.java
index e24933a..08a4a8f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/VertexTraversal.java
@@ -36,10 +36,10 @@ public interface VertexTraversal extends ElementTraversal<Vertex> {
return traversal.addStep(new StartStep<>(traversal, this));
}
- @Override
+ /*@Override
public default <E2> GraphTraversal<Vertex, VertexProperty<E2>> properties(final String... propertyKeys) {
return (GraphTraversal) this.start().properties(propertyKeys);
- }
+ }*/
public default <E2> GraphTraversal<Vertex, Map<String, List<VertexProperty<E2>>>> propertyMap(final String... propertyKeys) {
return this.start().propertyMap(propertyKeys);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java
index 20fe8a0..7afc504 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeOtherVertexStep.java
@@ -21,7 +21,6 @@ package org.apache.tinkerpop.gremlin.process.graph.traversal.step.map;
import org.apache.tinkerpop.gremlin.process.Traversal;
import org.apache.tinkerpop.gremlin.process.Traverser;
import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
@@ -44,9 +43,9 @@ public final class EdgeOtherVertexStep extends MapStep<Edge, Vertex> {
final List<Object> objects = traverser.path().objects();
for (int i = objects.size() - 2; i >= 0; i--) {
if (objects.get(i) instanceof Vertex) {
- return ElementHelper.areEqual((Vertex) objects.get(i), traverser.get().iterators().vertexIterator(Direction.OUT).next()) ?
- traverser.get().iterators().vertexIterator(Direction.IN).next() :
- traverser.get().iterators().vertexIterator(Direction.OUT).next();
+ return ElementHelper.areEqual((Vertex) objects.get(i), traverser.get().outVertex()) ?
+ traverser.get().inVertex() :
+ traverser.get().outVertex();
}
}
throw new IllegalStateException("The path history of the traverser does not contain a previous vertex: " + traverser.path());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java
index ac95634..99975c5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/EdgeVertexStep.java
@@ -45,7 +45,7 @@ public final class EdgeVertexStep extends FlatMapStep<Edge, Vertex> implements R
@Override
protected Iterator<Vertex> flatMap(final Traverser.Admin<Edge> traverser) {
- return traverser.get().iterators().vertexIterator(this.direction);
+ return traverser.get().vertices(this.direction);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/PropertiesStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/PropertiesStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/PropertiesStep.java
index 25c559a..cd0053e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/PropertiesStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/PropertiesStep.java
@@ -48,8 +48,8 @@ public class PropertiesStep<E> extends FlatMapStep<Element, E> implements Revers
@Override
protected Iterator<E> flatMap(final Traverser.Admin<Element> traverser) {
return this.returnType.equals(PropertyType.VALUE) ?
- traverser.get().iterators().valueIterator(this.propertyKeys) :
- (Iterator) traverser.get().iterators().propertyIterator(this.propertyKeys);
+ traverser.get().values(this.propertyKeys) :
+ (Iterator) traverser.get().properties(this.propertyKeys);
}
public PropertyType getReturnType() {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/VertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/VertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/VertexStep.java
index 8e52aa3..a73dcec 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/VertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/VertexStep.java
@@ -51,8 +51,8 @@ public class VertexStep<E extends Element> extends FlatMapStep<Vertex, E> implem
@Override
protected Iterator<E> flatMap(final Traverser.Admin<Vertex> traverser) {
return Vertex.class.isAssignableFrom(this.returnClass) ?
- (Iterator<E>) traverser.get().iterators().vertexIterator(this.direction, this.edgeLabels) :
- (Iterator<E>) traverser.get().iterators().edgeIterator(this.direction, this.edgeLabels);
+ (Iterator<E>) traverser.get().vertices(this.direction, this.edgeLabels) :
+ (Iterator<E>) traverser.get().edges(this.direction, this.edgeLabels);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SackElementValueStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SackElementValueStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SackElementValueStep.java
index 0dc4d79..57ba41c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SackElementValueStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SackElementValueStep.java
@@ -49,7 +49,7 @@ public final class SackElementValueStep<S extends Element, V> extends SideEffect
@Override
protected void sideEffect(final Traverser.Admin<S> traverser) {
- traverser.get().iterators().valueIterator(this.propertyKey).forEachRemaining(value -> {
+ traverser.get().values(this.propertyKey).forEachRemaining(value -> {
traverser.sack(this.operator.apply(traverser.sack(), (V) value));
});
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SubgraphStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SubgraphStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SubgraphStep.java
index de1090b..74f457c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SubgraphStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/SubgraphStep.java
@@ -104,9 +104,9 @@ public final class SubgraphStep extends SideEffectStep<Edge> implements SideEffe
final Iterator<Vertex> vertexIterator = subgraph.vertices(vertex.id());
if (vertexIterator.hasNext()) return vertexIterator.next();
final Vertex subgraphVertex = subgraph.addVertex(T.id, vertex.id(), T.label, vertex.label());
- vertex.iterators().propertyIterator().forEachRemaining(vertexProperty -> {
+ vertex.properties().forEachRemaining(vertexProperty -> {
final VertexProperty<?> subgraphVertexProperty = subgraphVertex.property(vertexProperty.key(), vertexProperty.value(), T.id, vertexProperty.id()); // TODO: demand vertex property id?
- vertexProperty.iterators().propertyIterator().forEachRemaining(property -> subgraphVertexProperty.<Object>property(property.key(), property.value()));
+ vertexProperty.properties().forEachRemaining(property -> subgraphVertexProperty.<Object>property(property.key(), property.value()));
});
return subgraphVertex;
}
@@ -114,10 +114,10 @@ public final class SubgraphStep extends SideEffectStep<Edge> implements SideEffe
private static void addEdgeToSubgraph(final Graph subgraph, final Edge edge) {
final Iterator<Edge> edgeIterator = subgraph.edges(edge.id());
if (edgeIterator.hasNext()) return;
- final Iterator<Vertex> vertexIterator = edge.iterators().vertexIterator(Direction.BOTH);
+ final Iterator<Vertex> vertexIterator = edge.vertices(Direction.BOTH);
final Vertex subGraphOutVertex = getOrCreate(subgraph, vertexIterator.next());
final Vertex subGraphInVertex = getOrCreate(subgraph, vertexIterator.next());
final Edge subGraphEdge = subGraphOutVertex.addEdge(edge.label(), subGraphInVertex, T.id, edge.id());
- edge.iterators().propertyIterator().forEachRemaining(property -> subGraphEdge.<Object>property(property.key(), property.value()));
+ edge.properties().forEachRemaining(property -> subGraphEdge.<Object>property(property.key(), property.value()));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/util/HasContainer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/util/HasContainer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/util/HasContainer.java
index 6bfbe1b..1edf474 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/util/HasContainer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/util/HasContainer.java
@@ -21,7 +21,6 @@ package org.apache.tinkerpop.gremlin.process.graph.util;
import org.apache.tinkerpop.gremlin.process.T;
import org.apache.tinkerpop.gremlin.structure.Contains;
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;
@@ -73,7 +72,7 @@ public final class HasContainer implements Serializable {
return this.predicate.test(((VertexProperty) element).key(), this.value);
else {
if (element instanceof Vertex) {
- final Iterator<? extends Property> itty = element.iterators().propertyIterator(this.key);
+ final Iterator<? extends Property> itty = element.properties(this.key);
while (itty.hasNext()) {
if (this.predicate.test(itty.next().value(), this.value))
return true;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Edge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Edge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Edge.java
index f750b55..9f074dd 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Edge.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Edge.java
@@ -18,8 +18,6 @@
*/
package org.apache.tinkerpop.gremlin.structure;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.EdgeTraversal;
-
import java.util.Iterator;
/**
@@ -37,7 +35,7 @@ import java.util.Iterator;
* @author Marko A. Rodriguez (http://markorodriguez.com)
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
-public interface Edge extends Element, EdgeTraversal {
+public interface Edge extends Element {
/**
* The default label to use for an edge.
@@ -45,38 +43,32 @@ public interface Edge extends Element, EdgeTraversal {
*/
public static final String DEFAULT_LABEL = "edge";
- /**
- * Gets the {@link Edge.Iterators} set.
- * <p/>
- * {@inheritDoc}
- */
- @Override
- public Edge.Iterators iterators();
/**
- * An interface that provides access to iterators over properties and vertices, without constructing a
- * {@link org.apache.tinkerpop.gremlin.process.Traversal} object.
+ * Retrieve the vertex (or vertices) associated with this edge as defined by the direction.
+ * If the direction is {@link Direction#BOTH} then the iterator order is: {@link Direction#OUT} then {@link Direction#IN}.
+ *
+ * @param direction Get the incoming vertex, outgoing vertex, or both vertices
+ * @return An iterator with 1 or 2 vertices
*/
- public interface Iterators extends Element.Iterators {
-
- /**
- * Retrieve the vertex (or vertices) associated with this edge as defined by the direction.
- * If the direction is {@link Direction#BOTH} then the iterator order is: {@link Direction#OUT} then {@link Direction#IN}.
- *
- * @param direction Get the incoming vertex, outgoing vertex, or both vertices
- * @return An iterator with 1 or 2 vertices
- */
- public Iterator<Vertex> vertexIterator(final Direction direction);
+ public Iterator<Vertex> vertices(final Direction direction);
- /**
- * {@inheritDoc}
- */
- @Override
- public <V> Iterator<Property<V>> propertyIterator(final String... propertyKeys);
+ public default Vertex outVertex() {
+ return this.vertices(Direction.OUT).next();
+ }
+ public default Vertex inVertex() {
+ return this.vertices(Direction.IN).next();
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public <V> Iterator<Property<V>> properties(final String... propertyKeys);
+
+
+ /**
* Common exceptions to use with an edge.
*/
public static class Exceptions extends Element.Exceptions {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
index 23c14a5..313eef8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
@@ -66,16 +66,16 @@ public abstract interface Element {
*/
public default Set<String> keys() {
final Set<String> keys = new HashSet<>();
- this.iterators().propertyIterator().forEachRemaining(property -> keys.add(property.key()));
+ this.properties().forEachRemaining(property -> keys.add(property.key()));
return Collections.unmodifiableSet(keys);
}
/**
* Get a {@link Property} for the {@code Element} given its key.
- * The default implementation calls the raw {@link Element#iterators#propertyIterator}.
+ * The default implementation calls the raw {@link Element#properties}.
*/
public default <V> Property<V> property(final String key) {
- final Iterator<? extends Property<V>> iterator = this.iterators().propertyIterator(key);
+ final Iterator<? extends Property<V>> iterator = this.properties(key);
return iterator.hasNext() ? iterator.next() : Property.<V>empty();
}
@@ -101,32 +101,20 @@ public abstract interface Element {
*/
public void remove();
+
/**
- * Gets the iterators for the {@code Element}. Iterators provide low-level access to the data associated with
- * an {@code Element} as they do not come with the overhead of {@link org.apache.tinkerpop.gremlin.process.Traversal}
- * construction. Use iterators in places where performance is most crucial.
+ * Get the values of properties as an {@link Iterator}.
*/
- public Element.Iterators iterators();
+ @Graph.Helper
+ public default <V> Iterator<V> values(final String... propertyKeys) {
+ return IteratorUtils.map(this.<V>properties(propertyKeys), property -> property.value());
+ }
/**
- * An interface that provides access to iterators over properties of an {@code Element}, without constructing a
- * {@link org.apache.tinkerpop.gremlin.process.Traversal} object.
+ * Get an {@link Iterator} of properties.
*/
- public interface Iterators {
-
- /**
- * Get the values of properties as an {@link Iterator}.
- */
- @Graph.Helper
- public default <V> Iterator<V> valueIterator(final String... propertyKeys) {
- return IteratorUtils.map(this.<V>propertyIterator(propertyKeys), property -> property.value());
- }
+ public <V> Iterator<? extends Property<V>> properties(final String... propertyKeys);
- /**
- * Get an {@link Iterator} of properties.
- */
- public <V> Iterator<? extends Property<V>> propertyIterator(final String... propertyKeys);
- }
/**
* Common exceptions to use with an element.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Vertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Vertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Vertex.java
index c8d48b0..19b6e39 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Vertex.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Vertex.java
@@ -37,7 +37,7 @@ import java.util.Optional;
* @author Marko A. Rodriguez (http://markorodriguez.com)
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
-public interface Vertex extends Element, VertexTraversal {
+public interface Vertex extends Element {
/**
* The default label to use for a vertex.
@@ -58,7 +58,7 @@ public interface Vertex extends Element, VertexTraversal {
@Override
public default <V> VertexProperty<V> property(final String key) {
- final Iterator<VertexProperty<V>> iterator = this.iterators().propertyIterator(key);
+ final Iterator<VertexProperty<V>> iterator = this.properties(key);
if (iterator.hasNext()) {
final VertexProperty<V> property = iterator.next();
if (iterator.hasNext())
@@ -88,10 +88,10 @@ public interface Vertex extends Element, VertexTraversal {
if (cardinality.equals(VertexProperty.Cardinality.list))
return this.property(key, value, keyValues);
else if (cardinality.equals(VertexProperty.Cardinality.single)) {
- this.iterators().propertyIterator(key).forEachRemaining(VertexProperty::remove);
+ this.properties(key).forEachRemaining(VertexProperty::remove);
return this.property(key, value, keyValues);
} else if (cardinality.equals(VertexProperty.Cardinality.set)) {
- final Iterator<VertexProperty<V>> iterator = this.iterators().propertyIterator(key);
+ final Iterator<VertexProperty<V>> iterator = this.properties(key);
while (iterator.hasNext()) {
final VertexProperty<V> property = iterator.next();
if (property.value().equals(value)) {
@@ -105,44 +105,30 @@ public interface Vertex extends Element, VertexTraversal {
}
}
+
/**
- * Get the {@link Vertex.Iterators} implementation associated with this {@code Vertex}.
- * <p/>
- * {@inheritDoc}
+ * Gets an {@link Iterator} of incident edges.
+ *
+ * @param direction The incident direction of the edges to retrieve off this vertex
+ * @param edgeLabels The labels of the edges to retrieve. If no labels are provided, then get all edges.
+ * @return An iterator of edges meeting the provided specification
*/
- @Override
- public Vertex.Iterators iterators();
+ public Iterator<Edge> edges(final Direction direction, final String... edgeLabels);
/**
- * An interface that provides access to iterators over {@link VertexProperty} objects, {@link Edge} objects
- * and adjacent vertices, associated with the {@code Vertex}, without constructing a
- * {@link org.apache.tinkerpop.gremlin.process.Traversal} object.
+ * Gets an {@link Iterator} of adjacent vertices.
+ *
+ * @param direction The adjacency direction of the vertices to retrieve off this vertex
+ * @param edgeLabels The labels of the edges associated with the vertices to retrieve. If no labels are provided, then get all edges.
+ * @return An iterator of vertices meeting the provided specification
*/
- public interface Iterators extends Element.Iterators {
- /**
- * Gets an {@link Iterator} of incident edges.
- *
- * @param direction The incident direction of the edges to retrieve off this vertex
- * @param edgeLabels The labels of the edges to retrieve. If no labels are provided, then get all edges.
- * @return An iterator of edges meeting the provided specification
- */
- public Iterator<Edge> edgeIterator(final Direction direction, final String... edgeLabels);
-
- /**
- * Gets an {@link Iterator} of adjacent vertices.
- *
- * @param direction The adjacency direction of the vertices to retrieve off this vertex
- * @param edgeLabels The labels of the edges associated with the vertices to retrieve. If no labels are provided, then get all edges.
- * @return An iterator of vertices meeting the provided specification
- */
- public Iterator<Vertex> vertexIterator(final Direction direction, final String... edgeLabels);
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <V> Iterator<VertexProperty<V>> propertyIterator(final String... propertyKeys);
- }
+ public Iterator<Vertex> vertices(final Direction direction, final String... edgeLabels);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys);
/**
* Common exceptions to use with a vertex.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
index 8541427..57418fa 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
@@ -18,7 +18,6 @@
*/
package org.apache.tinkerpop.gremlin.structure;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.VertexPropertyTraversal;
import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyVertexProperty;
import java.util.Iterator;
@@ -36,7 +35,7 @@ import java.util.Iterator;
* @author Marko A. Rodriguez (http://markorodriguez.com)
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
-public interface VertexProperty<V> extends Property<V>, Element, VertexPropertyTraversal {
+public interface VertexProperty<V> extends Property<V>, Element {
public static final String DEFAULT_LABEL = "vertexProperty";
@@ -76,24 +75,11 @@ public interface VertexProperty<V> extends Property<V>, Element, VertexPropertyT
}
/**
- * Gets the {@link VertexProperty.Iterators} set.
- * <p/>
* {@inheritDoc}
*/
@Override
- public VertexProperty.Iterators iterators();
+ public <U> Iterator<Property<U>> properties(final String... propertyKeys);
- /**
- * An interface that provides access to iterators over properties, without constructing a
- * {@link org.apache.tinkerpop.gremlin.process.Traversal} object.
- */
- public interface Iterators extends Element.Iterators {
- /**
- * {@inheritDoc}
- */
- @Override
- public <U> Iterator<Property<U>> propertyIterator(final String... propertyKeys);
- }
/**
* Common exceptions to use with a property.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
index 067fc75..1d61008 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLWriter.java
@@ -179,8 +179,8 @@ public class GraphMLWriter implements GraphWriter {
for (Edge edge : edges) {
writer.writeStartElement(GraphMLTokens.EDGE);
writer.writeAttribute(GraphMLTokens.ID, edge.id().toString());
- writer.writeAttribute(GraphMLTokens.SOURCE, edge.outV().next().id().toString());
- writer.writeAttribute(GraphMLTokens.TARGET, edge.inV().next().id().toString());
+ writer.writeAttribute(GraphMLTokens.SOURCE, edge.outVertex().id().toString());
+ writer.writeAttribute(GraphMLTokens.TARGET, edge.inVertex().id().toString());
writer.writeStartElement(GraphMLTokens.DATA);
writer.writeAttribute(GraphMLTokens.KEY, this.edgeLabelKey);
@@ -206,8 +206,8 @@ public class GraphMLWriter implements GraphWriter {
final Edge edge = iterator.next();
writer.writeStartElement(GraphMLTokens.EDGE);
writer.writeAttribute(GraphMLTokens.ID, edge.id().toString());
- writer.writeAttribute(GraphMLTokens.SOURCE, edge.outV().next().id().toString());
- writer.writeAttribute(GraphMLTokens.TARGET, edge.inV().next().id().toString());
+ writer.writeAttribute(GraphMLTokens.SOURCE, edge.outVertex().id().toString());
+ writer.writeAttribute(GraphMLTokens.TARGET, edge.inVertex().id().toString());
writer.writeStartElement(GraphMLTokens.DATA);
writer.writeAttribute(GraphMLTokens.KEY, this.edgeLabelKey);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index cedb4ca..93f9c0d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -29,12 +29,20 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.apache.tinkerpop.gremlin.process.Path;
import org.apache.tinkerpop.gremlin.process.util.metric.Metrics;
import org.apache.tinkerpop.gremlin.process.util.metric.TraversalMetrics;
-import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+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.detached.DetachedVertexProperty;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
@@ -82,16 +90,16 @@ public class GraphSONModule extends SimpleModule {
jsonGenerator.writeObject(m);
}
- private static Map<String, Object> props(final VertexProperty property) {
+ private static Map<String, Object> props(final VertexProperty<?> property) {
if (property instanceof DetachedVertexProperty) {
try {
- return IteratorUtils.collectMap(property.iterators().propertyIterator(), Property::key, Property::value);
+ return IteratorUtils.collectMap(property.properties(), Property::key, Property::value);
} catch (UnsupportedOperationException uoe) {
return new HashMap<>();
}
} else {
return (property.graph().features().vertex().supportsMetaProperties()) ?
- IteratorUtils.collectMap(property.iterators().propertyIterator(), Property::key, Property::value) :
+ IteratorUtils.collectMap(property.properties(), Property::key, Property::value) :
new HashMap<>();
}
}
@@ -145,14 +153,14 @@ public class GraphSONModule extends SimpleModule {
m.put(GraphSONTokens.LABEL, edge.label());
m.put(GraphSONTokens.TYPE, GraphSONTokens.EDGE);
- final Map<String, Object> properties = IteratorUtils.collectMap(edge.iterators().propertyIterator(), Property::key, Property::value);
+ final Map<String, Object> properties = IteratorUtils.collectMap(edge.properties(), Property::key, Property::value);
m.put(GraphSONTokens.PROPERTIES, properties);
- final Vertex inV = edge.iterators().vertexIterator(Direction.IN).next();
+ final Vertex inV = edge.inVertex();
m.put(GraphSONTokens.IN, inV.id());
m.put(GraphSONTokens.IN_LABEL, inV.label());
- final Vertex outV = edge.iterators().vertexIterator(Direction.OUT).next();
+ final Vertex outV = edge.outVertex();
m.put(GraphSONTokens.OUT, outV.id());
m.put(GraphSONTokens.OUT_LABEL, outV.label());
@@ -188,7 +196,7 @@ public class GraphSONModule extends SimpleModule {
// convert to GraphSONVertexProperty so that the label does not get serialized in the output - it is
// redundant because the key in the map is the same as the label.
- final Iterator<GraphSONVertexProperty> vertexPropertyList = IteratorUtils.map(vertex.iterators().propertyIterator(), GraphSONVertexProperty::new);
+ final Iterator<GraphSONVertexProperty> vertexPropertyList = IteratorUtils.map(vertex.properties(), GraphSONVertexProperty::new);
final Object properties = IteratorUtils.groupBy(vertexPropertyList, vp -> vp.getToSerialize().key());
m.put(GraphSONTokens.PROPERTIES, properties);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
index fd9f329..16f43b1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java
@@ -108,7 +108,7 @@ public class GraphSONReader implements GraphReader {
readVertexData(vertexData, detachedVertex -> {
final Iterator<Vertex> iterator = graph.vertices(detachedVertex.id());
final Vertex v = iterator.hasNext() ? iterator.next() : graph.addVertex(T.label, detachedVertex.label(), T.id, detachedVertex.id());
- detachedVertex.iterators().propertyIterator().forEachRemaining(p -> createVertexProperty(graphToWriteTo, v, p, false));
+ detachedVertex.properties().forEachRemaining(p -> createVertexProperty(graphToWriteTo, v, p, false));
return v;
});
}
@@ -116,11 +116,11 @@ public class GraphSONReader implements GraphReader {
while (parser.nextToken() != JsonToken.END_ARRAY) {
final Map<String, Object> edgeData = parser.readValueAs(mapTypeReference);
readEdgeData(edgeData, detachedEdge -> {
- final Vertex vOut = graph.vertices(detachedEdge.iterators().vertexIterator(Direction.OUT).next().id()).next();
- final Vertex vIn = graph.vertices(detachedEdge.iterators().vertexIterator(Direction.IN).next().id()).next();
+ final Vertex vOut = graph.vertices(detachedEdge.outVertex().id()).next();
+ final Vertex vIn = graph.vertices(detachedEdge.inVertex().id()).next();
// batchgraph checks for edge id support and uses it if possible.
final Edge e = vOut.addEdge(edgeData.get(GraphSONTokens.LABEL).toString(), vIn, T.id, detachedEdge.id());
- detachedEdge.iterators().propertyIterator().forEachRemaining(p -> e.<Object>property(p.key(), p.value()));
+ detachedEdge.properties().forEachRemaining(p -> e.<Object>property(p.key(), p.value()));
return e;
});
}
@@ -174,7 +174,7 @@ public class GraphSONReader implements GraphReader {
final List<Object> propertyArgs = new ArrayList<>();
if (graphToWriteTo.features().vertex().properties().supportsUserSuppliedIds())
propertyArgs.addAll(Arrays.asList(T.id, p.id()));
- p.iterators().propertyIterator().forEachRemaining(it -> propertyArgs.addAll(Arrays.asList(it.key(), it.value())));
+ p.properties().forEachRemaining(it -> propertyArgs.addAll(Arrays.asList(it.key(), it.value())));
v.property(p.key(), p.value(), propertyArgs.toArray());
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java
index 7a05e49..2444570 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertex.java
@@ -77,15 +77,15 @@ class GraphSONVertex {
m.put(GraphSONTokens.LABEL, vertex.label());
m.put(GraphSONTokens.TYPE, GraphSONTokens.VERTEX);
- final Object properties = IteratorUtils.groupBy(vertex.iterators().propertyIterator(), Property::key);
+ final Object properties = IteratorUtils.groupBy(vertex.properties(), Property::key);
m.put(GraphSONTokens.PROPERTIES, properties);
if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.OUT) {
- m.put(GraphSONTokens.OUT_E, IteratorUtils.fill(vertex.iterators().edgeIterator(Direction.OUT), new ArrayList()));
+ m.put(GraphSONTokens.OUT_E, IteratorUtils.fill(vertex.edges(Direction.OUT), new ArrayList()));
}
if (directionalVertex.getDirection() == Direction.BOTH || directionalVertex.getDirection() == Direction.IN) {
- m.put(GraphSONTokens.IN_E, IteratorUtils.fill(vertex.iterators().edgeIterator(Direction.IN), new ArrayList()));
+ m.put(GraphSONTokens.IN_E, IteratorUtils.fill(vertex.edges(Direction.IN), new ArrayList()));
}
jsonGenerator.writeObject(m);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertexProperty.java
index f09c2ca..7a46182 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVertexProperty.java
@@ -76,16 +76,16 @@ public class GraphSONVertexProperty {
jsonGenerator.writeObject(m);
}
- private static Map<String, Object> props(final VertexProperty property) {
+ private static Map<String, Object> props(final VertexProperty<?> property) {
if (property instanceof DetachedVertexProperty) {
try {
- return IteratorUtils.collectMap(property.iterators().propertyIterator(), Property::key, Property::value);
+ return IteratorUtils.collectMap(property.properties(), Property::key, Property::value);
} catch (UnsupportedOperationException uoe) {
return new HashMap<>();
}
} else {
return (property.graph().features().vertex().supportsMetaProperties()) ?
- IteratorUtils.collectMap(property.iterators().propertyIterator(), Property::key, Property::value) :
+ IteratorUtils.collectMap(property.properties(), Property::key, Property::value) :
new HashMap<>();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
index 8a9abbc..4d6d33e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
@@ -166,7 +166,7 @@ public class GryoReader implements GraphReader {
final Vertex v = graph.addVertex(vertexArgs.toArray());
vertexArgs.clear();
- current.iterators().propertyIterator().forEachRemaining(p -> createVertexProperty(graphToWriteTo, v, p, false));
+ current.properties().forEachRemaining(p -> createVertexProperty(graphToWriteTo, v, p, false));
// the gio file should have been written with a direction specified
final boolean hasDirectionSpecified = input.readBoolean();
@@ -207,7 +207,7 @@ public class GryoReader implements GraphReader {
final List<Object> propertyArgs = new ArrayList<>();
if (graphToWriteTo.features().vertex().properties().supportsUserSuppliedIds())
appendToArgList(propertyArgs, T.id, p.id());
- p.iterators().propertyIterator().forEachRemaining(it -> appendToArgList(propertyArgs, it.key(), it.value()));
+ p.properties().forEachRemaining(it -> appendToArgList(propertyArgs, it.key(), it.value()));
v.property(p.key(), p.value(), propertyArgs.toArray());
}
@@ -312,10 +312,10 @@ public class GryoReader implements GraphReader {
Object next = kryo.readClassAndObject(input);
while (!next.equals(EdgeTerminator.INSTANCE)) {
final DetachedEdge detachedEdge = (DetachedEdge) next;
- final Vertex vOut = graphToWriteTo.vertices(detachedEdge.iterators().vertexIterator(Direction.OUT).next().id()).next();
- final Vertex inV = graphToWriteTo.vertices(detachedEdge.iterators().vertexIterator(Direction.IN).next().id()).next();
+ final Vertex vOut = graphToWriteTo.vertices(detachedEdge.vertices(Direction.OUT).next().id()).next();
+ final Vertex inV = graphToWriteTo.vertices(detachedEdge.vertices(Direction.IN).next().id()).next();
- detachedEdge.iterators().propertyIterator().forEachRemaining(p -> edgeArgs.addAll(Arrays.asList(p.key(), p.value())));
+ detachedEdge.properties().forEachRemaining(p -> edgeArgs.addAll(Arrays.asList(p.key(), p.value())));
appendToArgList(edgeArgs, T.id, detachedEdge.id());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
index 28ef2d7..454571b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
@@ -125,10 +125,10 @@ public class GryoWriter implements GraphWriter {
final Vertex v = (Vertex) e;
kryo.writeObject(output, direction);
if (direction == Direction.BOTH || direction == Direction.OUT)
- writeDirectionalEdges(output, Direction.OUT, v.iterators().edgeIterator(Direction.OUT));
+ writeDirectionalEdges(output, Direction.OUT, v.edges(Direction.OUT));
if (direction == Direction.BOTH || direction == Direction.IN)
- writeDirectionalEdges(output, Direction.IN, v.iterators().edgeIterator(Direction.IN));
+ writeDirectionalEdges(output, Direction.IN, v.edges(Direction.IN));
}
kryo.writeClassAndObject(output, VertexTerminator.INSTANCE);
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategy.java
index c05aa74..40e5cce 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategy.java
@@ -20,13 +20,12 @@ package org.apache.tinkerpop.gremlin.structure.strategy;
import org.apache.tinkerpop.gremlin.process.Step;
import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.DefaultGraphTraversal;
import org.apache.tinkerpop.gremlin.process.graph.traversal.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.graph.traversal.step.filter.HasStep;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.DefaultGraphTraversal;
import org.apache.tinkerpop.gremlin.process.graph.util.HasContainer;
-import org.apache.tinkerpop.gremlin.process.traversal.engine.StandardTraversalEngine;
-import org.apache.tinkerpop.gremlin.process.traverser.util.DefaultTraverserGeneratorFactory;
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.process.traverser.util.DefaultTraverserGeneratorFactory;
import org.apache.tinkerpop.gremlin.structure.Contains;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -104,7 +103,7 @@ public final class PartitionStrategy implements GraphStrategy {
@Override
public UnaryOperator<BiFunction<Direction, String[], Iterator<Vertex>>> getVertexIteratorsVertexIteratorStrategy(final StrategyContext<StrategyVertex> ctx, final GraphStrategy composingStrategy) {
return (f) -> (direction, labels) -> StreamFactory
- .stream(ctx.getCurrent().getBaseVertex().iterators().edgeIterator(direction, labels))
+ .stream(ctx.getCurrent().getBaseVertex().edges(direction, labels))
.filter(this::testEdge)
.map(edge -> otherVertex(direction, ctx.getCurrent(), edge)).iterator();
// TODO: Note that we are not doing f.apply() like the other methods. Is this bad?
@@ -158,18 +157,18 @@ public final class PartitionStrategy implements GraphStrategy {
// inV() and/or outV() will be empty if they do not. it is sometimes the case that an edge is unwrapped
// in which case it may not be filtered. in such cases, the vertices on such edges should be tested.
return testElement(edge)
- && (edge instanceof StrategyWrapped ? edge.iterators().vertexIterator(Direction.IN).hasNext() && edge.iterators().vertexIterator(Direction.OUT).hasNext()
- : testVertex(edge.iterators().vertexIterator(Direction.IN).next()) && testVertex(edge.iterators().vertexIterator(Direction.OUT).next()));
+ && (edge instanceof StrategyWrapped ? edge.vertices(Direction.IN).hasNext() && edge.vertices(Direction.OUT).hasNext()
+ : testVertex(edge.vertices(Direction.IN).next()) && testVertex(edge.vertices(Direction.OUT).next()));
}
private static final Vertex otherVertex(final Direction direction, final Vertex start, final Edge edge) {
if (direction.equals(Direction.BOTH)) {
- final Vertex inVertex = edge.iterators().vertexIterator(Direction.IN).next();
+ final Vertex inVertex = edge.vertices(Direction.IN).next();
return ElementHelper.areEqual(start, inVertex) ?
- edge.iterators().vertexIterator(Direction.OUT).next() :
+ edge.vertices(Direction.OUT).next() :
inVertex;
} else {
- return edge.iterators().vertexIterator(direction.opposite()).next();
+ return edge.vertices(direction.opposite()).next();
}
}
@@ -222,7 +221,7 @@ public final class PartitionStrategy implements GraphStrategy {
@Override
public <V> UnaryOperator<Function<String[], Iterator<V>>> getVertexIteratorsValueIteratorStrategy(final StrategyContext<StrategyVertex> ctx, final GraphStrategy composingStrategy) {
- return (f) -> (keys) -> IteratorUtils.map(ctx.getCurrent().iterators().<V>propertyIterator(keys), vertexProperty -> vertexProperty.value());
+ return (f) -> (keys) -> IteratorUtils.map(ctx.getCurrent().<V>properties(keys), vertexProperty -> vertexProperty.value());
}
@Override
@@ -255,7 +254,7 @@ public final class PartitionStrategy implements GraphStrategy {
@Override
public <V> UnaryOperator<Function<String[], Iterator<V>>> getEdgeIteratorsValueIteratorStrategy(final StrategyContext<StrategyEdge> ctx, final GraphStrategy composingStrategy) {
- return (f) -> (keys) -> IteratorUtils.map(ctx.getCurrent().iterators().<V>propertyIterator(keys), property -> property.value());
+ return (f) -> (keys) -> IteratorUtils.map(ctx.getCurrent().<V>properties(keys), property -> property.value());
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyEdge.java
index d0fc00e..b7dcb47 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyEdge.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyEdge.java
@@ -34,7 +34,7 @@ import java.util.Set;
/**
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
-public class StrategyEdge extends StrategyElement implements Edge, Edge.Iterators, StrategyWrapped, WrappedEdge<Edge> {
+public class StrategyEdge extends StrategyElement implements Edge, StrategyWrapped, WrappedEdge<Edge> {
private final StrategyContext<StrategyEdge> strategyContext;
@@ -44,11 +44,6 @@ public class StrategyEdge extends StrategyElement implements Edge, Edge.Iterator
}
@Override
- public Edge.Iterators iterators() {
- return this;
- }
-
- @Override
public Graph graph() {
return this.strategyGraph.compose(
s -> s.getEdgeGraphStrategy(this.strategyContext, strategy),
@@ -119,24 +114,24 @@ public class StrategyEdge extends StrategyElement implements Edge, Edge.Iterator
@Override
- public Iterator<Vertex> vertexIterator(final Direction direction) {
+ public Iterator<Vertex> vertices(final Direction direction) {
return new StrategyVertex.StrategyVertexIterator(this.strategyGraph.compose(
s -> s.getEdgeIteratorsVertexIteratorStrategy(this.strategyContext, strategy),
- (Direction d) -> this.getBaseEdge().iterators().vertexIterator(d)).apply(direction), this.strategyGraph);
+ (Direction d) -> this.getBaseEdge().vertices(d)).apply(direction), this.strategyGraph);
}
@Override
- public <V> Iterator<V> valueIterator(final String... propertyKeys) {
+ public <V> Iterator<V> values(final String... propertyKeys) {
return this.strategyGraph.compose(
s -> s.<V>getEdgeIteratorsValueIteratorStrategy(this.strategyContext, strategy),
- (String[] pks) -> this.getBaseEdge().iterators().valueIterator(pks)).apply(propertyKeys);
+ (String[] pks) -> this.getBaseEdge().values(pks)).apply(propertyKeys);
}
@Override
- public <V> Iterator<Property<V>> propertyIterator(final String... propertyKeys) {
+ public <V> Iterator<Property<V>> properties(final String... propertyKeys) {
return IteratorUtils.map(this.strategyGraph.compose(
s -> s.<V>getEdgeIteratorsPropertyIteratorStrategy(this.strategyContext, strategy),
- (String[] pks) -> this.getBaseEdge().iterators().propertyIterator(pks)).apply(propertyKeys),
+ (String[] pks) -> this.getBaseEdge().properties(pks)).apply(propertyKeys),
property -> new StrategyProperty<>(property, this.strategyGraph));
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertex.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertex.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertex.java
index 87c1bc2..1d05fb9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertex.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertex.java
@@ -35,7 +35,7 @@ import java.util.Set;
* @author Stephen Mallette (http://stephen.genoprime.com)
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class StrategyVertex extends StrategyElement implements Vertex, StrategyWrapped, WrappedVertex<Vertex>, Vertex.Iterators {
+public class StrategyVertex extends StrategyElement implements Vertex, StrategyWrapped, WrappedVertex<Vertex> {
private final StrategyContext<StrategyVertex> strategyContext;
@@ -73,11 +73,6 @@ public class StrategyVertex extends StrategyElement implements Vertex, StrategyW
}
@Override
- public Vertex.Iterators iterators() {
- return this;
- }
-
- @Override
public <V> V value(final String key) throws NoSuchElementException {
return this.strategyGraph.compose(
s -> s.<V>getVertexValueStrategy(this.strategyContext, strategy),
@@ -128,31 +123,31 @@ public class StrategyVertex extends StrategyElement implements Vertex, StrategyW
}
@Override
- public Iterator<Edge> edgeIterator(final Direction direction, final String... edgeLabels) {
+ public Iterator<Edge> edges(final Direction direction, final String... edgeLabels) {
return new StrategyEdge.StrategyEdgeIterator(this.strategyGraph.compose(
s -> s.getVertexIteratorsEdgeIteratorStrategy(this.strategyContext, strategy),
- (Direction d, String[] l) -> this.getBaseVertex().iterators().edgeIterator(d, l)).apply(direction, edgeLabels), this.strategyGraph);
+ (Direction d, String[] l) -> this.getBaseVertex().edges(d, l)).apply(direction, edgeLabels), this.strategyGraph);
}
@Override
- public Iterator<Vertex> vertexIterator(final Direction direction, final String... labels) {
+ public Iterator<Vertex> vertices(final Direction direction, final String... labels) {
return new StrategyVertexIterator(this.strategyGraph.compose(
s -> s.getVertexIteratorsVertexIteratorStrategy(strategyContext, strategy),
- (Direction d, String[] l) -> this.getBaseVertex().iterators().vertexIterator(d, l)).apply(direction, labels), this.strategyGraph);
+ (Direction d, String[] l) -> this.getBaseVertex().vertices(d, l)).apply(direction, labels), this.strategyGraph);
}
@Override
- public <V> Iterator<V> valueIterator(final String... propertyKeys) {
+ public <V> Iterator<V> values(final String... propertyKeys) {
return this.strategyGraph.compose(
s -> s.<V>getVertexIteratorsValueIteratorStrategy(strategyContext, strategy),
- (String[] pks) -> this.getBaseVertex().iterators().valueIterator(pks)).apply(propertyKeys);
+ (String[] pks) -> this.getBaseVertex().values(pks)).apply(propertyKeys);
}
@Override
- public <V> Iterator<VertexProperty<V>> propertyIterator(final String... propertyKeys) {
+ public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) {
return IteratorUtils.map(this.strategyGraph.compose(
s -> s.<V>getVertexIteratorsPropertyIteratorStrategy(this.strategyContext, strategy),
- (String[] pks) -> this.getBaseVertex().iterators().propertyIterator(pks)).apply(propertyKeys),
+ (String[] pks) -> this.getBaseVertex().properties(pks)).apply(propertyKeys),
property -> new StrategyVertexProperty<>(property, this.strategyGraph));
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertexProperty.java
index 56e028c..eeb6bba 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/StrategyVertexProperty.java
@@ -34,7 +34,7 @@ import java.util.Set;
* @author Stephen Mallette (http://stephen.genoprime.com)
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class StrategyVertexProperty<V> extends StrategyElement implements VertexProperty<V>, StrategyWrapped, WrappedVertexProperty<VertexProperty<V>>, VertexProperty.Iterators {
+public class StrategyVertexProperty<V> extends StrategyElement implements VertexProperty<V>, StrategyWrapped, WrappedVertexProperty<VertexProperty<V>> {
private final StrategyContext<StrategyVertexProperty<V>> strategyContext;
@@ -79,11 +79,6 @@ public class StrategyVertexProperty<V> extends StrategyElement implements Vertex
}
@Override
- public VertexProperty.Iterators iterators() {
- return this;
- }
-
- @Override
public <U> Property<U> property(final String key, final U value) {
return new StrategyProperty<>(this.strategyGraph.compose(
s -> s.<U, V>getVertexPropertyPropertyStrategy(strategyContext, strategy),
@@ -129,17 +124,17 @@ public class StrategyVertexProperty<V> extends StrategyElement implements Vertex
@Override
- public <U> Iterator<Property<U>> propertyIterator(final String... propertyKeys) {
+ public <U> Iterator<Property<U>> properties(final String... propertyKeys) {
return IteratorUtils.map(this.strategyGraph.compose(
s -> s.<U, V>getVertexPropertyIteratorsPropertyIteratorStrategy(this.strategyContext, strategy),
- (String[] pks) -> this.getBaseVertexProperty().iterators().propertyIterator(pks)).apply(propertyKeys),
+ (String[] pks) -> this.getBaseVertexProperty().properties(pks)).apply(propertyKeys),
property -> new StrategyProperty<>(property, this.strategyGraph));
}
@Override
- public <U> Iterator<U> valueIterator(final String... propertyKeys) {
+ public <U> Iterator<U> values(final String... propertyKeys) {
return this.strategyGraph.compose(
s -> s.<U, V>getVertexPropertyIteratorsValueIteratorStrategy(this.strategyContext, strategy),
- (String[] pks) -> this.getBaseVertexProperty().iterators().valueIterator(pks)).apply(propertyKeys);
+ (String[] pks) -> this.getBaseVertexProperty().values(pks)).apply(propertyKeys);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SubgraphStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SubgraphStrategy.java
index c8e8bd5..b2f17ff 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SubgraphStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/SubgraphStrategy.java
@@ -56,7 +56,7 @@ public final class SubgraphStrategy implements GraphStrategy {
@Override
public UnaryOperator<BiFunction<Direction, String[], Iterator<Vertex>>> getVertexIteratorsVertexIteratorStrategy(final StrategyContext<StrategyVertex> ctx, final GraphStrategy composingStrategy) {
return (f) -> (direction, labels) -> StreamFactory
- .stream(ctx.getCurrent().getBaseVertex().iterators().edgeIterator(direction, labels))
+ .stream(ctx.getCurrent().getBaseVertex().edges(direction, labels))
.filter(this::testEdge)
.map(edge -> otherVertex(direction, ctx.getCurrent(), edge))
.filter(this::testVertex).iterator();
@@ -100,18 +100,18 @@ public final class SubgraphStrategy implements GraphStrategy {
// inV() and/or outV() will be empty if they do not. it is sometimes the case that an edge is unwrapped
// in which case it may not be filtered. in such cases, the vertices on such edges should be tested.
return edgePredicate.test(edge)
- && (edge instanceof StrategyWrapped ? edge.inV().hasNext() && edge.outV().hasNext()
- : testVertex(edge.inV().next()) && testVertex(edge.outV().next()));
+ && (edge instanceof StrategyWrapped ? edge.vertices(Direction.IN).hasNext() && edge.vertices(Direction.OUT).hasNext()
+ : testVertex(edge.inVertex()) && testVertex(edge.outVertex()));
}
private static final Vertex otherVertex(final Direction direction, final Vertex start, final Edge edge) {
if (direction.equals(Direction.BOTH)) {
- final Vertex inVertex = edge.iterators().vertexIterator(Direction.IN).next();
+ final Vertex inVertex = edge.vertices(Direction.IN).next();
return ElementHelper.areEqual(start, inVertex) ?
- edge.iterators().vertexIterator(Direction.OUT).next() :
+ edge.vertices(Direction.OUT).next() :
inVertex;
} else {
- return edge.iterators().vertexIterator(direction.opposite()).next();
+ return edge.vertices(direction.opposite()).next();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
index fc2112e..8b35557 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
@@ -394,19 +394,19 @@ public final class ElementHelper {
public static Map<String, Object> propertyValueMap(final Element element, final String... propertyKeys) {
final Map<String, Object> values = new HashMap<>();
- element.iterators().propertyIterator(propertyKeys).forEachRemaining(property -> values.put(property.key(), property.value()));
+ element.properties(propertyKeys).forEachRemaining(property -> values.put(property.key(), property.value()));
return values;
}
public static Map<String, Property> propertyMap(final Element element, final String... propertyKeys) {
final Map<String, Property> propertyMap = new HashMap<>();
- element.iterators().propertyIterator(propertyKeys).forEachRemaining(property -> propertyMap.put(property.key(), property));
+ element.properties(propertyKeys).forEachRemaining(property -> propertyMap.put(property.key(), property));
return propertyMap;
}
public static Map<String, List> vertexPropertyValueMap(final Vertex vertex, final String... propertyKeys) {
final Map<String, List> valueMap = new HashMap<>();
- vertex.iterators().propertyIterator(propertyKeys).forEachRemaining(property -> {
+ vertex.properties(propertyKeys).forEachRemaining(property -> {
if (valueMap.containsKey(property.key()))
valueMap.get(property.key()).add(property.value());
else {
@@ -420,7 +420,7 @@ public final class ElementHelper {
public static Map<String, List<VertexProperty>> vertexPropertyMap(final Vertex vertex, final String... propertyKeys) {
final Map<String, List<VertexProperty>> propertyMap = new HashMap<>();
- vertex.iterators().propertyIterator(propertyKeys).forEachRemaining(property -> {
+ vertex.properties(propertyKeys).forEachRemaining(property -> {
if (propertyMap.containsKey(property.key()))
propertyMap.get(property.key()).add(property);
else {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java
index ac9993c..e8e1f81 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/StringFactory.java
@@ -27,7 +27,6 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
import org.apache.tinkerpop.gremlin.process.computer.Memory;
import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
-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;
@@ -89,9 +88,7 @@ public final class StringFactory {
* Construct the representation for a {@link org.apache.tinkerpop.gremlin.structure.Edge}.
*/
public static String edgeString(final Edge edge) {
- final Vertex inV = edge.iterators().vertexIterator(Direction.IN).next();
- final Vertex outV = edge.iterators().vertexIterator(Direction.OUT).next();
- return E + L_BRACKET + edge.id() + R_BRACKET + L_BRACKET + outV.id() + DASH + edge.label() + ARROW + inV.id() + R_BRACKET;
+ return E + L_BRACKET + edge.id() + R_BRACKET + L_BRACKET + edge.outVertex().id() + DASH + edge.label() + ARROW + edge.inVertex().id() + R_BRACKET;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/batch/BatchGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
index 5bbcc8d..d6b0159 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/batch/BatchGraph.java
@@ -24,7 +24,6 @@ import org.apache.tinkerpop.gremlin.process.T;
import org.apache.tinkerpop.gremlin.process.Traversal;
import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
import org.apache.tinkerpop.gremlin.process.graph.traversal.GraphTraversal;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.VertexTraversal;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
@@ -350,7 +349,7 @@ public class BatchGraph<G extends Graph> implements Graph {
}
}
- private class BatchVertex implements Vertex, Vertex.Iterators, VertexTraversal {
+ private class BatchVertex implements Vertex {
private final Object externalID;
@@ -452,27 +451,22 @@ public class BatchGraph<G extends Graph> implements Graph {
}
@Override
- public Vertex.Iterators iterators() {
- return this;
- }
-
- @Override
- public Iterator<Edge> edgeIterator(final Direction direction, final String... edgeLabels) {
+ public Iterator<Edge> edges(final Direction direction, final String... edgeLabels) {
throw retrievalNotSupported();
}
@Override
- public Iterator<Vertex> vertexIterator(final Direction direction, final String... labels) {
+ public Iterator<Vertex> vertices(final Direction direction, final String... labels) {
throw retrievalNotSupported();
}
@Override
- public <V> Iterator<VertexProperty<V>> propertyIterator(final String... propertyKeys) {
- return getCachedVertex(externalID).iterators().propertyIterator(propertyKeys);
+ public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) {
+ return getCachedVertex(externalID).properties(propertyKeys);
}
}
- private class BatchEdge implements Edge, Edge.Iterators {
+ private class BatchEdge implements Edge {
@Override
@@ -523,18 +517,13 @@ public class BatchGraph<G extends Graph> implements Graph {
}
@Override
- public Edge.Iterators iterators() {
- return this;
- }
-
- @Override
- public <V> Iterator<Property<V>> propertyIterator(final String... propertyKeys) {
- return getWrappedEdge().iterators().propertyIterator(propertyKeys);
+ public <V> Iterator<Property<V>> properties(final String... propertyKeys) {
+ return getWrappedEdge().properties(propertyKeys);
}
@Override
- public Iterator<Vertex> vertexIterator(final Direction direction) {
- return getWrappedEdge().iterators().vertexIterator(direction);
+ public Iterator<Vertex> vertices(final Direction direction) {
+ return getWrappedEdge().vertices(direction);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2a723753/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
index c1429cb..4c8ea05 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedEdge.java
@@ -49,7 +49,7 @@ import java.util.NoSuchElementException;
* @author Stephen Mallette (http://stephen.genoprime.com)
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class DetachedEdge extends DetachedElement<Edge> implements Edge, Edge.Iterators {
+public class DetachedEdge extends DetachedElement<Edge> implements Edge {
private DetachedVertex outVertex;
private DetachedVertex inVertex;
@@ -60,14 +60,14 @@ public class DetachedEdge extends DetachedElement<Edge> implements Edge, Edge.It
protected DetachedEdge(final Edge edge, final boolean withProperties) {
super(edge);
- this.outVertex = DetachedFactory.detach(edge.iterators().vertexIterator(Direction.OUT).next(), false);
- this.inVertex = DetachedFactory.detach(edge.iterators().vertexIterator(Direction.IN).next(), false);
+ this.outVertex = DetachedFactory.detach(edge.vertices(Direction.OUT).next(), false);
+ this.inVertex = DetachedFactory.detach(edge.vertices(Direction.IN).next(), false);
// only serialize properties if requested, the graph supports it and there are meta properties present.
// this prevents unnecessary object creation of a new HashMap of a new HashMap which will just be empty.
// it will use Collections.emptyMap() by default
if (withProperties) {
- final Iterator<Property<Object>> propertyIterator = edge.iterators().propertyIterator();
+ final Iterator<Property<Object>> propertyIterator = edge.properties();
if (propertyIterator.hasNext()) {
this.properties = new HashMap<>();
propertyIterator.forEachRemaining(property -> this.properties.put(property.key(), Collections.singletonList(DetachedFactory.detach(property))));
@@ -96,7 +96,7 @@ public class DetachedEdge extends DetachedElement<Edge> implements Edge, Edge.It
@Override
public Edge attach(final Vertex hostVertex) {
- final Iterator<Edge> edges = IteratorUtils.filter(hostVertex.iterators().edgeIterator(Direction.OUT, this.label), edge -> edge.equals(this));
+ final Iterator<Edge> edges = IteratorUtils.filter(hostVertex.edges(Direction.OUT, this.label), edge -> edge.equals(this));
if (!edges.hasNext())
throw new IllegalStateException("The detached edge could not be be found incident to the provided vertex: " + this);
return edges.next();
@@ -129,7 +129,7 @@ public class DetachedEdge extends DetachedElement<Edge> implements Edge, Edge.It
}
if (ElementHelper.areEqual(outV, inV)) {
- final Iterator<Edge> itty = outV.iterators().edgeIterator(Direction.OUT, detachedEdge.label());
+ final Iterator<Edge> itty = outV.edges(Direction.OUT, detachedEdge.label());
while (itty.hasNext()) {
final Edge e = itty.next();
if (ElementHelper.areEqual(detachedEdge, e))
@@ -143,12 +143,7 @@ public class DetachedEdge extends DetachedElement<Edge> implements Edge, Edge.It
}
@Override
- public Edge.Iterators iterators() {
- return this;
- }
-
- @Override
- public Iterator<Vertex> vertexIterator(final Direction direction) {
+ public Iterator<Vertex> vertices(final Direction direction) {
switch (direction) {
case OUT:
return IteratorUtils.of(this.outVertex);
@@ -160,7 +155,7 @@ public class DetachedEdge extends DetachedElement<Edge> implements Edge, Edge.It
}
@Override
- public <V> Iterator<Property<V>> propertyIterator(final String... propertyKeys) {
- return (Iterator) super.propertyIterator(propertyKeys);
+ public <V> Iterator<Property<V>> properties(final String... propertyKeys) {
+ return (Iterator) super.properties(propertyKeys);
}
}