当前位置: 首页>>代码示例>>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;未经允许,请勿转载。