本文整理了Java中com.tinkerpop.blueprints.Direction
类的一些代码示例,展示了Direction
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Direction
类的具体详情如下:
包路径:com.tinkerpop.blueprints.Direction
类名称:Direction
[英]Direction is used to denote the direction of an edge or location of a vertex on an edge. For example, gremlin--knows-->rexster is an OUT edge for Gremlin and an IN edge for Rexster. Moreover, given that edge, Gremlin is the OUT vertex and Rexster is the IN vertex.
[中]方向用于表示边的方向或边上顶点的位置。例如,gremlin——知道-->rexster是gremlin的外缘,rexster的内缘。此外,给定该边,Gremlin是外顶点,Rexster是内顶点。
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public Direction opposite() {
if (this.equals(OUT))
return IN;
else if (this.equals(IN))
return OUT;
else
return BOTH;
}
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Reducer.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
if (!this.direction.equals(BOTH))
this.direction = this.direction.opposite();
this.labels = context.getConfiguration().getStrings(LABELS);
this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}
代码示例来源:origin: thinkaurelius/faunus
public static Configuration createConfiguration(final Direction direction) {
final Configuration configuration = new EmptyConfiguration();
configuration.set(DIRECTION, direction.name());
return configuration;
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Reducer.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(LinkMapReduce.DIRECTION));
this.direction = this.direction.opposite();
this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}
代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames
public Object processEdge(final Range annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Edge edge, final Direction direction) {
return framedGraph.frame(edge.getVertex(direction.opposite()), method.getReturnType());
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Mapper.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
}
代码示例来源:origin: com.tinkerpop/frames
public Object processEdge(final Range annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Edge edge, final Direction direction) {
return framedGraph.frame(edge.getVertex(direction.opposite()), method.getReturnType());
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Reducer.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
this.direction = this.direction.opposite();
this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Mapper.Context context) throws IOException, InterruptedException {
this.step = context.getConfiguration().getInt(STEP, -1);
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
this.label = context.getConfiguration().get(LABEL);
this.mergeDuplicates = context.getConfiguration().getBoolean(MERGE_DUPLICATES, false);
this.mergeWeightKey = context.getConfiguration().get(MERGE_WEIGHT_KEY, NO_WEIGHT_KEY);
this.pathEnabled = context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false);
if (!this.pathEnabled)
throw new IllegalStateException(LinkMapReduce.class.getSimpleName() + " requires that paths be enabled");
}
代码示例来源:origin: com.tinkerpop/pipes
private LinkPipe(final Direction direction, final String label) {
this.direction = direction;
this.label = label;
if (direction.equals(Direction.BOTH))
this.sideEffect = new ArrayList<Edge>();
}
代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames
private void removeEdges(final Direction direction, final String label, final Vertex element, final Vertex otherVertex, final FramedGraph framedGraph) {
for (final Edge edge : element.getEdges(direction, label)) {
if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) {
framedGraph.removeEdge(edge);
}
}
}
}
代码示例来源:origin: thinkaurelius/faunus
public static Configuration createConfiguration(final Direction direction, final String... labels) {
final Configuration configuration = new EmptyConfiguration();
configuration.set(DIRECTION, direction.name());
configuration.setStrings(LABELS, labels);
return configuration;
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Mapper.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
this.labels = context.getConfiguration().getStrings(LABELS, new String[0]);
this.pathEnabled = context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false);
this.edge = new FaunusEdge(this.pathEnabled);
}
代码示例来源:origin: thinkaurelius/faunus
public long getVertexId(final Direction direction) {
if (OUT.equals(direction)) {
return this.outVertex;
} else if (IN.equals(direction)) {
return this.inVertex;
} else {
throw ExceptionFactory.bothIsNotSupported();
}
}
代码示例来源:origin: com.tinkerpop/frames
private void removeEdges(final Direction direction, final String label, final Vertex element, final Vertex otherVertex, final FramedGraph framedGraph) {
for (final Edge edge : element.getEdges(direction, label)) {
if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) {
framedGraph.removeEdge(edge);
}
}
}
}
代码示例来源:origin: thinkaurelius/faunus
public static Configuration createConfiguration(final Direction direction, final String... labels) {
final Configuration configuration = new EmptyConfiguration();
configuration.set(DIRECTION, direction.name());
configuration.setStrings(LABELS, labels);
return configuration;
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Mapper.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
this.labels = context.getConfiguration().getStrings(LABELS, new String[0]);
this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public Vertex getVertex(final Direction direction) throws IllegalArgumentException {
if (direction.equals(Direction.IN))
return this.inVertex;
else if (direction.equals(Direction.OUT))
return this.outVertex;
else
throw ExceptionFactory.bothIsNotSupported();
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void reduce(final LongWritable key, final Iterable<Holder<FaunusVertex>> values, final Reducer<LongWritable, Holder<FaunusVertex>, NullWritable, FaunusVertex>.Context context) throws IOException, InterruptedException {
long edgesAggregated = 0;
this.vertex.reuse(key.get());
for (final Holder<FaunusVertex> holder : values) {
if (holder.getTag() == 's') {
edgesAggregated = edgesAggregated + ((List) holder.get().getEdges(direction.opposite())).size();
this.vertex.addEdges(direction.opposite(), holder.get());
} else {
this.vertex.addAll(holder.get());
}
}
context.write(NullWritable.get(), this.vertex);
context.getCounter(Counters.EDGES_ADDED).increment(edgesAggregated);
}
}
代码示例来源:origin: com.tinkerpop/pipes
public String toString() {
return PipeHelper.makePipeString(this, direction.name().toLowerCase(), Arrays.asList(labels));
}
}
内容来源于网络,如有侵权,请联系作者删除!