当前位置: 首页>>代码示例>>Java>>正文


Java IteratorUtils.concat方法代码示例

本文整理汇总了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);
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:22,代码来源:Artist.java

示例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));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:22,代码来源:StarGraph.java

示例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);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:LiteGraph.java

示例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);
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:11,代码来源:TinkerVertex.java

示例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);
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:29,代码来源:Song.java

示例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));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:StarGraph.java

示例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;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:33,代码来源:LiteVertex.java


注:本文中的org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.concat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。