本文整理了Java中org.apache.tinkerpop.gremlin.structure.Direction
类的一些代码示例,展示了Direction
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Direction
类的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.structure.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 Direction#OUT Edge for Gremlin and an Direction#IN edge for Rexster. Moreover, given that Edge, Gremlin is the Direction#OUT Vertex and Rexster is the Direction#INVertex.
[中]方向用于表示边的方向或边上顶点的位置。例如:
gremlin--knows-->rexster
对于小精灵来说是一个方向外边缘,对于雷克斯特来说是一个方向内边缘。此外,考虑到这条边,Gremlin是方向#出顶点,Rexster是方向#反相器。
代码示例来源:origin: apache/tinkerpop
/**
* Produce the opposite representation of the current {@code Direction} enum.
*/
public Direction opposite() {
if (this.equals(OUT))
return IN;
else if (this.equals(IN))
return OUT;
else
return BOTH;
}
}
代码示例来源:origin: thinkaurelius/titan
VertexStep vstep = (VertexStep)currentStep;
if (vstep.returnsEdge()
&& (direction==Direction.BOTH || direction.equals(vstep.getDirection().opposite()))) {
代码示例来源:origin: hugegraph/hugegraph
public static Direction parseDirection(String direction) {
if (direction == null || direction.isEmpty()) {
return Direction.BOTH;
}
try {
return Direction.valueOf(direction);
} catch (Exception e) {
throw new IllegalArgumentException(String.format(
"Direction value must be in [OUT, IN, BOTH], " +
"but got '%s'", direction));
}
}
代码示例来源:origin: thinkaurelius/titan
@Override
public EdgeLabel make() {
TypeDefinitionMap definition = makeDefinition();
Preconditions.checkArgument(unidirectionality==Direction.BOTH || !getMultiplicity().isUnique(unidirectionality.opposite()),
"Unidirectional labels cannot have restricted multiplicity at the other end");
Preconditions.checkArgument(unidirectionality==Direction.BOTH || !hasSortKey() ||
!getMultiplicity().isUnique(unidirectionality),
"Unidirectional labels with restricted multiplicity cannot have a sort key");
Preconditions.checkArgument(unidirectionality!=Direction.IN || definition.getValue(INVISIBLE,Boolean.class));
definition.setValue(UNIDIRECTIONAL, unidirectionality);
return tx.makeEdgeLabel(getName(), definition);
}
代码示例来源:origin: apache/tinkerpop
public Builder direction(final Direction direction) {
configuration.setProperty(DIRECTION_CFG_KEY, direction.toString());
return this;
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public int hashCode() {
int result = super.hashCode() ^ this.direction.hashCode() ^ this.returnClass.hashCode();
for (final String edgeLabel : this.edgeLabels) {
result ^= edgeLabel.hashCode();
}
return result;
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public EdgeLabel make() {
TypeDefinitionMap definition = makeDefinition();
Preconditions.checkArgument(unidirectionality==Direction.BOTH || !getMultiplicity().isUnique(unidirectionality.opposite()),
"Unidirectional labels cannot have restricted multiplicity at the other end");
Preconditions.checkArgument(unidirectionality==Direction.BOTH || !hasSortKey() ||
!getMultiplicity().isUnique(unidirectionality),
"Unidirectional labels with restricted multiplicity cannot have a sort key");
Preconditions.checkArgument(unidirectionality!=Direction.IN || definition.getValue(INVISIBLE,Boolean.class));
definition.setValue(UNIDIRECTIONAL, unidirectionality);
return tx.makeEdgeLabel(getName(), definition);
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-test
public Builder direction(final Direction direction) {
configuration.setProperty(DIRECTION_CFG_KEY, direction.toString());
return this;
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public int hashCode() {
return super.hashCode() ^ this.direction.hashCode();
}
代码示例来源:origin: apache/tinkerpop
public static org.neo4j.tinkerpop.api.Neo4jDirection mapDirection(final Direction direction) {
if (direction.equals(Direction.OUT))
return org.neo4j.tinkerpop.api.Neo4jDirection.OUTGOING;
else if (direction.equals(Direction.IN))
return org.neo4j.tinkerpop.api.Neo4jDirection.INCOMING;
else
return org.neo4j.tinkerpop.api.Neo4jDirection.BOTH;
}
代码示例来源:origin: JanusGraph/janusgraph
VertexStep vertexStep = (VertexStep) currentStep;
if (vertexStep.returnsEdge()
&& (direction == Direction.BOTH || direction.equals(vertexStep.getDirection().opposite()))) {
代码示例来源:origin: thinkaurelius/titan
int vertexcompare = AbstractElement.compare(r1.getVertex(EdgeDirection.position(dir1.opposite())),
r2.getVertex(EdgeDirection.position(dir1.opposite())));
if (vertexcompare != 0) return vertexcompare;
代码示例来源:origin: apache/tinkerpop
@Override
public void loadState(final Graph graph, final Configuration configuration) {
direction = Direction.valueOf(configuration.getString(DIRECTION_CFG_KEY));
switch (direction) {
case IN:
this.messageScope = this.inMessageScope;
break;
case OUT:
this.messageScope = this.outMessageScope;
break;
case BOTH:
this.messageScope = this.bothMessageScope;
break;
default:
throw new IllegalStateException("Should not reach this point!");
}
}
代码示例来源:origin: org.umlg/sqlg-core
private void internalToString(StringBuilder sb) {
if (sb.length() > 0) {
sb.append("\n");
}
for (int i = 0; i < this.stepDepth; i++) {
sb.append("\t");
}
sb.append(this.schemaTable.toString()).append(" ")
.append(this.stepDepth).append(" ")
.append(this.hasContainers.toString()).append(" ")
.append("Comparators = ")
.append(this.sqlgComparatorHolder.toString()).append(" ")
.append("Range = ")
.append(String.valueOf(this.sqlgRangeHolder.getRange())).append(" ")
.append(this.direction != null ? this.direction.toString() : "").append(" ")
.append("isVertexStep = ").append(this.isEdgeVertexStep())
.append(" isUntilFirst = ").append(this.isUntilFirst())
.append(" labels = ").append(this.labels);
for (SchemaTableTree child : children) {
child.internalToString(sb);
}
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
@Override
public int hashCode() {
int result = super.hashCode() ^ this.direction.hashCode() ^ this.returnClass.hashCode();
for (final String edgeLabel : this.edgeLabels) {
result ^= edgeLabel.hashCode();
}
return result;
}
代码示例来源:origin: thinkaurelius/titan
if (relation.direction.equals(Direction.IN)) {
} else if (relation.direction.equals(Direction.OUT)) {
代码示例来源:origin: apache/tinkerpop
/**
* Checks whether a given step is optimizable or not.
*
* @param step1 an edge-emitting step
* @param step2 a vertex-emitting step
* @return <code>true</code> if step1 is not labeled and emits edges and step2 emits vertices,
* otherwise <code>false</code>
*/
private static boolean isOptimizable(final Step step1, final Step step2) {
if (step1 instanceof VertexStep && ((VertexStep) step1).returnsEdge() && step1.getLabels().isEmpty()) {
final Direction step1Dir = ((VertexStep) step1).getDirection();
if (step1Dir.equals(Direction.BOTH)) {
return step2 instanceof EdgeOtherVertexStep;
}
return step2 instanceof EdgeOtherVertexStep || (step2 instanceof EdgeVertexStep &&
((EdgeVertexStep) step2).getDirection().equals(step1Dir.opposite()));
}
return false;
}
代码示例来源:origin: JanusGraph/janusgraph
int vertexCompare = AbstractElement.compare(r1.getVertex(EdgeDirection.position(dir1.opposite())),
r2.getVertex(EdgeDirection.position(dir1.opposite())));
if (vertexCompare != 0) return vertexCompare;
代码示例来源:origin: org.apache.tinkerpop/gremlin-test
@Override
public void loadState(final Graph graph, final Configuration configuration) {
direction = Direction.valueOf(configuration.getString(DIRECTION_CFG_KEY));
switch (direction) {
case IN:
this.messageScope = this.inMessageScope;
break;
case OUT:
this.messageScope = this.outMessageScope;
break;
case BOTH:
this.messageScope = this.bothMessageScope;
break;
default:
throw new IllegalStateException("Should not reach this point!");
}
}
代码示例来源:origin: pietermartin/sqlg
private void internalToString(StringBuilder sb) {
if (sb.length() > 0) {
sb.append("\n");
}
for (int i = 0; i < this.stepDepth; i++) {
sb.append("\t");
}
sb.append(this.schemaTable.toString()).append(" ")
.append(this.stepDepth).append(" ")
.append(this.hasContainers.toString()).append(" ")
.append("Comparators = ")
.append(this.sqlgComparatorHolder.toString()).append(" ")
.append("Range = ")
.append(String.valueOf(this.sqlgRangeHolder.getRange())).append(" ")
.append(this.direction != null ? this.direction.toString() : "").append(" ")
.append("isVertexStep = ").append(this.isEdgeVertexStep())
.append(" isUntilFirst = ").append(this.isUntilFirst())
.append(" labels = ").append(this.labels);
for (SchemaTableTree child : children) {
child.internalToString(sb);
}
}
内容来源于网络,如有侵权,请联系作者删除!