Merge remote-tracking branch 'origin/tp31'
Conflicts:
tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/78f7f3e5
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/78f7f3e5
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/78f7f3e5
Branch: refs/heads/TINKERPOP-1278
Commit: 78f7f3e506ec18fe2d61ad3dbc0a015854c353fb
Parents: 44ad2eb 1c9bd08
Author: Stephen Mallette <[email protected]>
Authored: Thu Jun 30 11:49:15 2016 -0400
Committer: Stephen Mallette <[email protected]>
Committed: Thu Jun 30 11:49:15 2016 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../gremlin/groovy/engine/GremlinExecutor.java | 2 +-
.../step/sideEffect/TinkerGraphStep.java | 15 +++----
.../tinkergraph/structure/TinkerGraph.java | 44 +++++++++++---------
4 files changed, 35 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/78f7f3e5/CHANGELOG.asciidoc
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/78f7f3e5/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/step/sideEffect/TinkerGraphStep.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/78f7f3e5/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --cc
tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 73a4205,af7245a..4cf264e
---
a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++
b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@@ -320,35 -322,20 +322,26 @@@ public final class TinkerGraph implemen
private <T extends Element> Iterator<T> createElementIterator(final
Class<T> clazz, final Map<Object, T> elements,
final
IdManager idManager,
final
Object... ids) {
+ final Iterator<T> iterator;
if (0 == ids.length) {
- return elements.values().iterator();
+ iterator = elements.values().iterator();
} else {
- // base the conversion function on the first item in the id list
as the expectation is that these
- // id values will be a uniform list
- if (clazz.isAssignableFrom(ids[0].getClass())) {
- // based on the first item assume all vertices in the
argument list
- if (!Stream.of(ids).allMatch(id ->
clazz.isAssignableFrom(id.getClass())))
- throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-
- // got a bunch of Elements - have to look each upup because
it might be an Attachable instance or
- // other implementation. the assumption is that id conversion
is not required for detached
- // stuff - doesn't seem likely someone would detach a Titan
vertex then try to expect that
- // vertex to be findable in OrientDB
- iterator = Stream.of(ids).map(id -> elements.get(((T)
id).id())).filter(Objects::nonNull).iterator();
- } else {
- final Class<?> firstClass = ids[0].getClass();
- if
(!Stream.of(ids).map(Object::getClass).allMatch(firstClass::equals))
- throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
- iterator = Stream.of(ids).map(id ->
idManager.convert(id)).map(elements::get).filter(Objects::nonNull).iterator();
- }
+ final List<Object> idList = Arrays.asList(ids);
+ validateHomogenousIds(idList);
+
+ // if the type is of Element - have to look each up because it
might be an Attachable instance or
+ // other implementation. the assumption is that id conversion is
not required for detached
+ // stuff - doesn't seem likely someone would detach a Titan
vertex then try to expect that
+ // vertex to be findable in OrientDB
+ return clazz.isAssignableFrom(ids[0].getClass()) ?
+ IteratorUtils.filter(IteratorUtils.map(idList, id ->
elements.get(clazz.cast(id).id())).iterator(), Objects::nonNull)
+ : IteratorUtils.filter(IteratorUtils.map(idList, id ->
elements.get(idManager.convert(id))).iterator(), Objects::nonNull);
}
+ return TinkerHelper.inComputerMode(this) ?
+ (Iterator<T>) (clazz.equals(Vertex.class) ?
+ IteratorUtils.filter((Iterator<Vertex>) iterator, t
-> this.graphComputerView.legalVertex(t)) :
+ IteratorUtils.filter((Iterator<Edge>) iterator, t ->
this.graphComputerView.legalEdge(t.outVertex(), t))) :
+ iterator;
}
/**