本文整理汇总了Java中org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.concat方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorUtils.concat方法的具体用法?Java IteratorUtils.concat怎么用?Java IteratorUtils.concat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils
的用法示例。
在下文中一共展示了IteratorUtils.concat方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: specificEdges
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Override
protected Iterator<Edge> specificEdges(Direction direction, String... edgeLabels) {
List<Iterator<?>> iterators = new LinkedList<>();
if (edgeLabels.length == 0) {
edgeLabels = ALL_EDGES;
}
for (String label : edgeLabels) {
if (label == WrittenBy.label) {
if (direction == Direction.IN || direction == Direction.BOTH) {
iterators.add(getWrittenByIn().iterator());
}
} else if (label == SungBy.label) {
if (direction == Direction.IN || direction == Direction.BOTH) {
iterators.add(getSungByIn().iterator());
}
}
}
Iterator<Edge>[] iteratorsArray = iterators.toArray(new Iterator[iterators.size()]);
return IteratorUtils.concat(iteratorsArray);
}
示例2: edges
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Override
public Iterator<Edge> edges(final Direction direction, final String... edgeLabels) {
if (direction.equals(Direction.OUT)) {
return null == this.outEdges ? Collections.emptyIterator() : edgeLabels.length == 0 ?
IteratorUtils.flatMap(this.outEdges.values().iterator(), List::iterator) :
this.outEdges.entrySet().stream()
.filter(entry -> ElementHelper.keyExists(entry.getKey(), edgeLabels))
.map(Map.Entry::getValue)
.flatMap(List::stream)
.iterator();
} else if (direction.equals(Direction.IN)) {
return null == this.inEdges ? Collections.emptyIterator() : edgeLabels.length == 0 ?
IteratorUtils.flatMap(this.inEdges.values().iterator(), List::iterator) :
this.inEdges.entrySet().stream()
.filter(entry -> ElementHelper.keyExists(entry.getKey(), edgeLabels))
.map(Map.Entry::getValue)
.flatMap(List::stream)
.iterator();
} else
return IteratorUtils.concat(this.edges(Direction.IN, edgeLabels), this.edges(Direction.OUT, edgeLabels));
}
示例3: edges
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Override
public Iterator<Edge> edges(final Object... edgeIds) {
//todo 8. buffer
if(edgeIds.length == 0)
{
Iterator iterator = this.vertices();
Iterator<Edge> finalIterator = null;
while(iterator.hasNext())
{
LiteVertex liteVertex = (LiteVertex) iterator.next();
finalIterator = IteratorUtils.concat(finalIterator, HugeZset.queryAllEdge(this, liteVertex.id.toString(), Utility.VERTEX_EDGE+liteVertex.id));
}
return finalIterator;
}
return queryEdgesFromRedisAsEdge(this, edgeIds);
//return createElementIterator(Edge.class, edges, edgeIdManager, edgeIds);
}
示例4: vertices
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Override
public Iterator<Vertex> vertices(final Direction direction, final String... edgeLabels) {
return TinkerHelper.inComputerMode(this.graph) ?
direction.equals(Direction.BOTH) ?
IteratorUtils.concat(
IteratorUtils.map(this.edges(Direction.OUT, edgeLabels), Edge::inVertex),
IteratorUtils.map(this.edges(Direction.IN, edgeLabels), Edge::outVertex)) :
IteratorUtils.map(this.edges(direction, edgeLabels), edge -> edge.vertices(direction.opposite()).next()) :
(Iterator) TinkerHelper.getVertices(this, direction, edgeLabels);
}
示例5: specificEdges
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Override
protected Iterator<Edge> specificEdges(Direction direction, String... edgeLabels) {
List<Iterator<?>> iterators = new LinkedList<>();
if (edgeLabels.length == 0) {
edgeLabels = ALL_EDGES;
}
for (String label : edgeLabels) {
if (label == FollowedBy.label) {
if (direction == Direction.IN || direction == Direction.BOTH) {
iterators.add(getFollowedByIn().iterator());
}
if (direction == Direction.OUT || direction == Direction.BOTH) {
iterators.add(getFollowedByOut().iterator());
}
} else if (label == WrittenBy.label) {
if (direction == Direction.OUT) {
iterators.add(getWrittenByOut().iterator());
}
} else if (label == SungBy.label) {
if (direction == Direction.OUT) {
iterators.add(getSungByOut().iterator());
}
}
}
Iterator<Edge>[] iteratorsArray = iterators.toArray(new Iterator[iterators.size()]);
return IteratorUtils.concat(iteratorsArray);
}
示例6: vertices
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Override
public Iterator<Vertex> vertices(final Direction direction, final String... edgeLabels) {
if (direction.equals(Direction.OUT))
return IteratorUtils.map(this.edges(direction, edgeLabels), Edge::inVertex);
else if (direction.equals(Direction.IN))
return IteratorUtils.map(this.edges(direction, edgeLabels), Edge::outVertex);
else
return IteratorUtils.concat(this.vertices(Direction.IN, edgeLabels), this.vertices(Direction.OUT, edgeLabels));
}
示例7: edges
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Override
public Iterator<Edge> edges(Direction direction, String... edgeLabels) {
//todo 6. code 10 buffer
Iterator<Edge> iterator = new HashSet<Edge>().iterator();//null;
if (edgeLabels.length == 0) {
iterator = HugeZset.queryAllEdge(direction, this.graph, this.id.toString(), Utility.VERTEX_EDGE+this.id);
/*
switch (direction) {
case IN:
iterator = queryAllEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id);
case OUT:
iterator = queryAllEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id);
default:
iterator = queryAllEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id);
iterator = IteratorUtils.concat(iterator, queryAllEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id));
}
*/
} else {
for (String label : edgeLabels) {
switch (direction) {
case IN:
iterator = IteratorUtils.concat(iterator, queryEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id, String.valueOf(ADD_SIGN) + DOT + label));
case OUT://todo
iterator = IteratorUtils.concat(iterator, queryEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id, String.valueOf(MINUS_SIGN) + DOT + label));
default:
iterator = IteratorUtils.concat(iterator, queryEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id, String.valueOf(ADD_SIGN) + DOT + label));
iterator = IteratorUtils.concat(iterator, queryEdge(this.graph, this.id.toString(), VERTEX_EDGE + this.id, String.valueOf(MINUS_SIGN) + DOT + label));
}
}
}
return iterator;
}