當前位置: 首頁>>代碼示例>>Java>>正文


Java Event類代碼示例

本文整理匯總了Java中org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event的典型用法代碼示例。如果您正苦於以下問題:Java Event類的具體用法?Java Event怎麽用?Java Event使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Event類屬於org.apache.tinkerpop.gremlin.process.traversal.step.util.event包,在下文中一共展示了Event類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的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

示例2: map

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
protected Edge map(final Traverser.Admin<S> traverser) {
    Vertex toVertex = this.parameters.get(traverser, TO, () -> (Vertex) traverser.get()).get(0);
    Vertex fromVertex = this.parameters.get(traverser, FROM, () -> (Vertex) traverser.get()).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 = 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 EventStrategy eventStrategy = getTraversal().getStrategies().getStrategy(EventStrategy.class).get();
        final Event.EdgeAddedEvent vae = new Event.EdgeAddedEvent(eventStrategy.detach(edge));
        callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
    }
    return edge;
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:21,代碼來源:AddEdgeStep.java

示例3: executeDropEdges

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
public static void executeDropEdges(SqlgGraph sqlgGraph, EdgeLabel edgeLabel, String sql, List<EventCallback<Event>> mutatingCallbacks) {
    try {
        Connection conn = sqlgGraph.tx().getConnection();
        if (logger.isDebugEnabled()) {
            logger.debug(sql);
        }
        try (Statement statement = conn.createStatement()) {
            if (mutatingCallbacks.isEmpty()) {
                statement.execute(sql);
            } else {
                ResultSet resultSet = statement.executeQuery(sql);
                while (resultSet.next()) {
                    Long id = resultSet.getLong(1);
                    final Event removeEvent;
                    removeEvent = new Event.EdgeRemovedEvent(SqlgEdge.of(sqlgGraph, id, edgeLabel.getSchema().getName(), edgeLabel.getName()));
                    for (EventCallback<Event> eventCallback : mutatingCallbacks) {
                        eventCallback.accept(removeEvent);
                    }
                }
            }
        }
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }

}
 
開發者ID:pietermartin,項目名稱:sqlg,代碼行數:27,代碼來源:SqlgSqlExecutor.java

示例4: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
protected Traverser.Admin<Vertex> processNextStart() {
    if (this.first) {
        this.first = false;
        final Vertex vertex = this.getTraversal().getGraph().get().addVertex(this.parameters.getKeyValues(EmptyTraverser.instance()));
        if (this.callbackRegistry != null) {
            final Event.VertexAddedEvent vae = new Event.VertexAddedEvent(DetachedFactory.detach(vertex, true));
            this.callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
        }
        return this.getTraversal().getTraverserGenerator().generate(vertex, this, 1l);
    } else
        throw FastNoSuchElementException.instance();
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:14,代碼來源:AddVertexStartStep.java

示例5: map

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
protected Edge map(final Traverser.Admin<S> traverser) {
    final Vertex toVertex = this.parameters.get(traverser, TO, () -> (Vertex) traverser.get()).get(0);
    final Vertex fromVertex = this.parameters.get(traverser, FROM, () -> (Vertex) traverser.get()).get(0);
    final String edgeLabel = 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 edge;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:14,代碼來源:AddEdgeStep.java

示例6: map

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
protected Vertex map(final Traverser.Admin<S> traverser) {
    final Vertex vertex = this.getTraversal().getGraph().get().addVertex(this.parameters.getKeyValues(traverser));
    if (this.callbackRegistry != null) {
        final Event.VertexAddedEvent vae = new Event.VertexAddedEvent(DetachedFactory.detach(vertex, true));
        this.callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
    }
    return vertex;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:10,代碼來源:AddVertexStep.java

示例7: sideEffect

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
protected void sideEffect(final Traverser.Admin<S> traverser) {
    final String key = (String) this.parameters.get(traverser, T.key, () -> {
        throw new IllegalStateException("The AddPropertyStep does not have a provided key: " + this);
    }).get(0);
    final Object value = this.parameters.get(traverser, T.value, () -> {
        throw new IllegalStateException("The AddPropertyStep does not have a provided value: " + this);
    }).get(0);
    final Object[] vertexPropertyKeyValues = this.parameters.getKeyValues(traverser, T.key, T.value);

    final Element element = traverser.get();


    if (this.callbackRegistry != null) {
        final Property currentProperty = traverser.get().property(key);
        final boolean newProperty = element instanceof Vertex ? currentProperty == VertexProperty.empty() : currentProperty == Property.empty();
        final Event.ElementPropertyChangedEvent evt;
        if (element instanceof Vertex)
            evt = new Event.VertexPropertyChangedEvent(DetachedFactory.detach((Vertex) element, true), newProperty ? null : DetachedFactory.detach((VertexProperty) currentProperty, true), value, vertexPropertyKeyValues);
        else if (element instanceof Edge)
            evt = new Event.EdgePropertyChangedEvent(DetachedFactory.detach((Edge) element, true), newProperty ? null : DetachedFactory.detach(currentProperty), value);
        else if (element instanceof VertexProperty)
            evt = new Event.VertexPropertyPropertyChangedEvent(DetachedFactory.detach((VertexProperty) element, true), newProperty ? null : DetachedFactory.detach(currentProperty), value);
        else
            throw new IllegalStateException(String.format("The incoming object cannot be processed by change eventing in %s:  %s", AddPropertyStep.class.getName(), element));

        this.callbackRegistry.getCallbacks().forEach(c -> c.accept(evt));
    }

    if (null != this.cardinality)
        ((Vertex) element).property(this.cardinality, key, value, vertexPropertyKeyValues);
    else if (vertexPropertyKeyValues.length > 0)
        ((Vertex) element).property(key, value, vertexPropertyKeyValues);
    else
        element.property(key, value);
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:37,代碼來源:AddPropertyStep.java

示例8: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
protected Traverser.Admin<Vertex> processNextStart() {
    if (this.first) {
        this.first = false;
        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
        final Vertex vertex = this.getTraversal().getGraph().get().addVertex(this.parameters.getKeyValues(generator.generate(false, (Step) this, 1L)));
        if (this.callbackRegistry != null) {
            final EventStrategy eventStrategy = getTraversal().getStrategies().getStrategy(EventStrategy.class).get();
            final Event.VertexAddedEvent vae = new Event.VertexAddedEvent(eventStrategy.detach(vertex));
            this.callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
        }
        return generator.generate(vertex, this, 1L);
    } else
        throw FastNoSuchElementException.instance();
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:16,代碼來源:AddVertexStartStep.java

示例9: map

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
protected Vertex map(final Traverser.Admin<S> traverser) {
    final Vertex vertex = this.getTraversal().getGraph().get().addVertex(this.parameters.getKeyValues(traverser));
    if (this.callbackRegistry != null) {
        final EventStrategy eventStrategy = getTraversal().getStrategies().getStrategy(EventStrategy.class).get();
        final Event.VertexAddedEvent vae = new Event.VertexAddedEvent(eventStrategy.detach(vertex));
        this.callbackRegistry.getCallbacks().forEach(c -> c.accept(vae));
    }
    return vertex;
}
 
開發者ID:apache,項目名稱:tinkerpop,代碼行數:11,代碼來源:AddVertexStep.java

示例10: getMutatingCallbackRegistry

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
public CallbackRegistry<Event.VertexAddedEvent> getMutatingCallbackRegistry() {
    if (null == this.callbackRegistry) this.callbackRegistry = new ListCallbackRegistry<>();
    return this.callbackRegistry;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:6,代碼來源:AddVertexStartStep.java

示例11: getMutatingCallbackRegistry

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
public CallbackRegistry<Event.EdgeAddedEvent> getMutatingCallbackRegistry() {
    if (null == this.callbackRegistry) this.callbackRegistry = new ListCallbackRegistry<>();
    return this.callbackRegistry;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:6,代碼來源:AddEdgeStep.java

示例12: getMutatingCallbackRegistry

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
public CallbackRegistry<Event.VertexAddedEvent> getMutatingCallbackRegistry() {
    if (null == callbackRegistry) callbackRegistry = new ListCallbackRegistry<>();
    return callbackRegistry;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:6,代碼來源:AddVertexStep.java

示例13: getMutatingCallbackRegistry

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
public CallbackRegistry<Event.ElementPropertyChangedEvent> getMutatingCallbackRegistry() {
    if (null == this.callbackRegistry) this.callbackRegistry = new ListCallbackRegistry<>();
    return this.callbackRegistry;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:6,代碼來源:AddPropertyStep.java

示例14: getMutatingCallbackRegistry

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
public CallbackRegistry<Event> getMutatingCallbackRegistry() {
    if (null == callbackRegistry) callbackRegistry = new ListCallbackRegistry<>();
    return callbackRegistry;
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:6,代碼來源:DropStep.java

示例15: accept

import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; //導入依賴的package包/類
@Override
public void accept(final Event event) {
    eventQueue.addEvent(event);
}
 
開發者ID:PKUSilvester,項目名稱:LiteGraph,代碼行數:5,代碼來源:EventStrategy.java


注:本文中的org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。