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


Java FastNoSuchElementException.instance方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException.instance方法的典型用法代码示例。如果您正苦于以下问题:Java FastNoSuchElementException.instance方法的具体用法?Java FastNoSuchElementException.instance怎么用?Java FastNoSuchElementException.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException的用法示例。


在下文中一共展示了FastNoSuchElementException.instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldThrowExceptionOnEInDifferentPartition

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldThrowExceptionOnEInDifferentPartition() {
    final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
            .partitionKey(partition).writePartition("A").addReadPartition("A").create();
    final GraphTraversalSource sourceAA = create(partitionStrategyAA);

    final PartitionStrategy partitionStrategyA = PartitionStrategy.build()
            .partitionKey(partition).writePartition("A").create();
    final GraphTraversalSource sourceA = create(partitionStrategyA);

    final Vertex vA = sourceAA.addV().property("any", "a").next();
    final Edge e = sourceAA.withSideEffect("vA", vA).V(vA.id()).addE("knows").to("vA").next();
    assertEquals(e.id(), g.E(e.id()).id().next());

    try {
        sourceA.E(e.id()).next();
        fail("Edge should not be in this partition");
    } catch (Exception ex) {
        final Exception expected = FastNoSuchElementException.instance();
        assertEquals(expected.getClass(), ex.getClass());
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:24,代码来源:PartitionStrategyProcessTest.java

示例2: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public T next() {
    if (this.iterators.isEmpty()) throw FastNoSuchElementException.instance();

    Iterator<T> currentIterator = iterators.get(this.current);
    while (true) {
        if (currentIterator.hasNext()) {
            return currentIterator.next();
        } else {
            this.current++;
            if (this.current >= iterators.size())
                break;
            currentIterator = iterators.get(current);
        }
    }
    throw FastNoSuchElementException.instance();
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:18,代码来源:CloseableIteratorUtils.java

示例3: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public Edge next() {
    try {
        while (true) {
            if (this.edgeIterator.hasNext())
                return new HadoopEdge(this.edgeIterator.next(), this.graph);
            if (this.readers.isEmpty())
                throw FastNoSuchElementException.instance();
            if (this.readers.peek().nextKeyValue()) {
                this.edgeIterator = this.readers.peek().getCurrentValue().get().edges(Direction.OUT);
            } else {
                this.readers.remove().close();
            }
        }
    } catch (final Exception e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:HadoopEdgeIterator.java

示例4: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public Vertex next() {
    try {
        if (this.nextVertex != null) {
            final Vertex temp = this.nextVertex;
            this.nextVertex = null;
            return temp;
        } else {
            while (!this.readers.isEmpty()) {
                if (this.readers.peek().nextKeyValue())
                    return new HadoopVertex(this.readers.peek().getCurrentValue().get(), this.graph);
                else
                    this.readers.remove().close();
            }
        }
        throw FastNoSuchElementException.instance();
    } catch (final Exception e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:21,代码来源:HadoopVertexIterator.java

示例5: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public String next() {
    try {
        if (this.available) {
            this.available = false;
            return this.line;
        } else {
            while (true) {
                if (this.readers.isEmpty())
                    throw FastNoSuchElementException.instance();
                if ((this.line = this.readers.peek().readLine()) != null) {
                    return this.line;
                } else
                    this.readers.remove().close();
            }
        }
    } catch (final IOException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:21,代码来源:TextIterator.java

示例6: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
protected Traverser.Admin<Edge> processNextStart() {
    if (this.first) {
        this.first = false;
        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
        final Traverser.Admin traverser = generator.generate(1, (Step) this, 1); // a dead traverser to trigger the traversal
        Vertex toVertex = (Vertex) this.parameters.get(traverser, TO, Collections::emptyList).get(0);
        Vertex fromVertex = (Vertex) this.parameters.get(traverser, FROM, Collections::emptyList).get(0);
        if (toVertex instanceof Attachable)
            toVertex = ((Attachable<Vertex>) toVertex)
                    .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
        if (fromVertex instanceof Attachable)
            fromVertex = ((Attachable<Vertex>) fromVertex)
                    .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
        final String edgeLabel = (String) this.parameters.get(traverser, T.label, () -> Edge.DEFAULT_LABEL).get(0);
        final Edge edge = fromVertex.addEdge(edgeLabel, toVertex, this.parameters.getKeyValues(traverser, TO, FROM, T.label));
        if (callbackRegistry != null) {
            final Event.EdgeAddedEvent vae = new Event.EdgeAddedEvent(DetachedFactory.detach(edge, true));
            callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
        }
        return generator.generate(edge, this, 1L);
    } else
        throw FastNoSuchElementException.instance();


}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:27,代码来源:AddEdgeStartStep.java

示例7: standardAlgorithm

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
protected Iterator<Traverser.Admin<E>> standardAlgorithm() {
    while (true) {
        if (!this.first) {
            for (final List<Traversal.Admin<S, E>> options : this.traversalOptions.values()) {
                for (final Traversal.Admin<S, E> option : options) {
                    if (option.hasNext())
                        return option.getEndStep();
                }
            }
        }
        this.first = false;
        ///
        if (this.hasBarrier) {
            if (!this.starts.hasNext())
                throw FastNoSuchElementException.instance();
            while (this.starts.hasNext()) {
                this.handleStart(this.starts.next());
            }
        } else {
            this.handleStart(this.starts.next());
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:25,代码来源:BranchStep.java

示例8: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
protected Traverser.Admin<E> processNextStart() throws NoSuchElementException {
    if (this.first) {
        this.first = false;
        while (this.starts.hasNext()) {
            this.localTraversal.addStart(this.starts.next());
        }
        while (this.localTraversal.hasNext()) {
            this.results.add(this.localTraversal.nextTraverser());
        }
        this.results.sort((o1, o2) -> {
            SqlgTraverser x = (SqlgTraverser) o1;
            SqlgTraverser y = (SqlgTraverser) o2;
            return Long.compare(x.getStartElementIndex(), y.getStartElementIndex());
        });
        this.resultIterator = this.results.iterator();
    }
    if (this.resultIterator.hasNext()) {
        Traverser.Admin<E> traverser = this.resultIterator.next();
        return traverser;
    } else {
        throw FastNoSuchElementException.instance();
    }
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:25,代码来源:SqlgLocalStepBarrier.java

示例9: applyRange

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
private boolean applyRange(Emit<E> emit) {
    if (this.lastReplacedStep.hasRange() && this.lastReplacedStep.applyInStep() && this.lastReplacedStep.getDepth() == emit.getReplacedStepDepth()) {
        if (this.lastReplacedStep.getSqlgRangeHolder().hasRange()) {
            if (this.lastReplacedStep.getSqlgRangeHolder().getRange().isBefore(this.rangeCount + 1)) {
                throw FastNoSuchElementException.instance();
            }
            if (this.lastReplacedStep.getSqlgRangeHolder().getRange().isAfter(this.rangeCount)) {
                this.rangeCount++;
                return true;
            }
        } else {
            Preconditions.checkState(this.lastReplacedStep.getSqlgRangeHolder().hasSkip(), "If not a range query then it must be a skip.");
            if (this.rangeCount < this.lastReplacedStep.getSqlgRangeHolder().getSkip()) {
                this.rangeCount++;
                return true;
            }
        }
        this.rangeCount++;
    }
    return false;
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:22,代码来源:SqlgGraphStep.java

示例10: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
protected Traverser.Admin<Long> processNextStart() throws NoSuchElementException {
    if (!this.done) {
        this.done = true;
        final TinkerGraph graph = (TinkerGraph) this.getTraversal().getGraph().get();
        return this.getTraversal().getTraverserGenerator().generate(Vertex.class.isAssignableFrom(this.elementClass) ?
                        (long) TinkerHelper.getVertices(graph).size() :
                        (long) TinkerHelper.getEdges(graph).size(),
                (Step) this, 1L);
    } else
        throw FastNoSuchElementException.instance();
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:13,代码来源:TinkerCountGlobalStep.java

示例11: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public T next() {
    if (this.current == 'x')
        throw FastNoSuchElementException.instance();
    else {
        if (this.current == 'a') {
            this.current = 'b';
            return this.a;
        } else {
            this.current = 'x';
            return this.b;
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:15,代码来源:DoubleIterator.java

示例12: flatMap

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
public static <S, E> Iterator<E> flatMap(final Iterator<S> iterator, final Function<S, Iterator<E>> function) {
    return new CloseableIterator<E>() {

        private Iterator<E> currentIterator = Collections.emptyIterator();

        @Override
        public boolean hasNext() {
            if (this.currentIterator.hasNext())
                return true;
            else {
                while (iterator.hasNext()) {
                    this.currentIterator = function.apply(iterator.next());
                    if (this.currentIterator.hasNext())
                        return true;
                }
            }
            return false;
        }

        @Override
        public void remove() {
            iterator.remove();
        }

        @Override
        public E next() {
            if (this.hasNext())
                return this.currentIterator.next();
            else
                throw FastNoSuchElementException.instance();
        }

        @Override
        public void close() {
            CloseableIterator.closeIterator(iterator);
        }
    };
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:39,代码来源:CloseableIteratorUtils.java

示例13: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public T next() {
    if (!this.alive)
        throw FastNoSuchElementException.instance();
    else {
        this.alive = false;
        return t;
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:SingleIterator.java

示例14: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public Tuple2<OK, OV> next() {
    if (!this.combineMap.isEmpty())
        return this.nextFromCombineMap();
    else if (!this.inputIterator.hasNext()) {
        this.mapReduce.workerEnd(MapReduce.Stage.COMBINE);
        throw FastNoSuchElementException.instance();
    } else {
        this.processNext();
        return this.next();
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:13,代码来源:CombineIterator.java

示例15: next

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入方法依赖的package包/类
@Override
public T next() {
    if (this.hasNext()) {
        this.current++;
        return this.array[this.current - 1];
    } else {
        throw FastNoSuchElementException.instance();
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:ArrayIterator.java


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