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


Java FastNoSuchElementException类代码示例

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


FastNoSuchElementException类属于org.apache.tinkerpop.gremlin.process.traversal.util包,在下文中一共展示了FastNoSuchElementException类的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:PKUSilvester,项目名称:LiteGraph,代码行数: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:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:TextIterator.java

示例6: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入依赖的package包/类
@Override
protected Traverser.Admin<E> processNextStart() {
    while (true) {
        if (this.iterator.hasNext()) {
            return this.isStart ? this.getTraversal().getTraverserGenerator().generate(this.iterator.next(), (Step) this, 1l) : this.head.split(this.iterator.next(), this);
        } else {
            if (this.isStart) {
                if (this.done)
                    throw FastNoSuchElementException.instance();
                else {
                    this.done = true;
                    this.iterator = null == this.iteratorSupplier ? EmptyIterator.instance() : this.iteratorSupplier.get();
                }
            } else {
                this.head = this.starts.next();
                this.iterator = null == this.iteratorSupplier ? EmptyIterator.instance() : this.iteratorSupplier.get();
            }
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:GraphStep.java

示例7: nextBarrier

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入依赖的package包/类
@Override
public Map<Object, Traverser.Admin<S>> nextBarrier() throws NoSuchElementException {
    final Map<Object, Traverser.Admin<S>> map = new HashMap<>();
    while (this.starts.hasNext()) {
        final Traverser.Admin<S> traverser = this.starts.next();
        final Object object;
        if (null != this.dedupLabels) {
            object = new ArrayList<>(this.dedupLabels.size());
            for (final String label : this.dedupLabels) {
                ((List) object).add(TraversalUtil.applyNullable((S) this.getScopeValue(Pop.last, label, traverser), this.dedupTraversal));
            }
        } else {
            object = TraversalUtil.applyNullable(traverser, this.dedupTraversal);
        }
        if (!map.containsKey(object)) {
            traverser.setBulk(1l);
            traverser.set(DetachedFactory.detach(traverser.get(), true));
            map.put(object, traverser);
        }
    }
    if (map.isEmpty())
        throw FastNoSuchElementException.instance();
    else
        return map;

}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:27,代码来源:DedupGlobalStep.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;
        this.localTraversal.addStart(this.starts.next());
    }
    while (true) {
        if (this.localTraversal.hasNext())
            return this.localTraversal.getEndStep().next();
        else if (this.starts.hasNext()) {
            this.localTraversal.reset();
            this.localTraversal.addStart(this.starts.next());
        } else {
            throw FastNoSuchElementException.instance();
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:LocalStep.java

示例9: 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:PKUSilvester,项目名称:LiteGraph,代码行数:25,代码来源:BranchStep.java

示例10: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入依赖的package包/类
@Override
protected Traverser.Admin<S> processNextStart() throws NoSuchElementException {
    if (resultsIter instanceof EmptyIterator) {
        while (starts.hasNext()) {
            Traverser.Admin<S> next = starts.next();
            B_O_S_SE_SL_Traverser traverser = (B_O_S_SE_SL_Traverser) next;
            if (traverser.getSideEffects().get("_whereStep") instanceof Traverser) {
                results.add(traverser.getSideEffects().get("_whereStep"));
            }
            ArrayList<Traverser.Admin<S>> whereStep = traverser.getSideEffects().get("_whereStep");
            for (Traverser.Admin<S> stringSMap : whereStep) {
                if (((Map<String, S>) stringSMap.get()).get(selectKey).equals(next.get())) {
                    results.add(stringSMap);
                }
            }
        }
        resultsIter = results.iterator();
    }
    if (resultsIter.hasNext())
        return resultsIter.next();
    throw FastNoSuchElementException.instance();
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:23,代码来源:UniGraphWhereTraversalStep.java

示例11: 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

示例12: 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;
        this.localTraversal.addStart(this.starts.next());
    }
    while (true) {
        if (this.localTraversal.hasNext())
            return this.localTraversal.nextTraverser();
        else if (this.starts.hasNext()) {
            this.localTraversal.reset();
            this.localTraversal.addStart(this.starts.next());
        } else {
            throw FastNoSuchElementException.instance();
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:18,代码来源:LocalStep.java

示例13: shouldThrowFastNoSuchElementExceptionInNestedTraversals

import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException; //导入依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void shouldThrowFastNoSuchElementExceptionInNestedTraversals() {
    //The nested traversal should throw a regular FastNoSuchElementException

    final GraphTraversal<Object, Object> nestedTraversal = __.has("name", "foo");
    final GraphTraversal<Vertex, Object> traversal = g.V().has("name", "marko").branch(nestedTraversal);

    final GraphTraversal.Admin<Object, Object> nestedTraversalAdmin = nestedTraversal.asAdmin();
    nestedTraversalAdmin.reset();
    nestedTraversalAdmin.addStart(nestedTraversalAdmin.getTraverserGenerator().generate(g.V().has("name", "marko").next(), (Step) traversal.asAdmin().getStartStep(), 1l));

    try {
        nestedTraversal.next();
    } catch (NoSuchElementException e) {
        assertEquals(FastNoSuchElementException.class, e.getClass());
    }

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

示例14: 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

示例15: 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


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