本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.Path.size方法的典型用法代码示例。如果您正苦于以下问题:Java Path.size方法的具体用法?Java Path.size怎么用?Java Path.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.process.traversal.Path
的用法示例。
在下文中一共展示了Path.size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: equals
import org.apache.tinkerpop.gremlin.process.traversal.Path; //导入方法依赖的package包/类
@Override
public boolean equals(final Object other) {
if (!(other instanceof Path))
return false;
final Path otherPath = (Path) other;
if (otherPath.size() != this.objects.size())
return false;
final List<Object> otherPathObjects = otherPath.objects();
final List<Set<String>> otherPathLabels = otherPath.labels();
for (int i = this.objects.size() - 1; i >= 0; i--) {
if (!this.objects.get(i).equals(otherPathObjects.get(i)))
return false;
if (!this.labels.get(i).equals(otherPathLabels.get(i)))
return false;
}
return true;
}
示例2: equals
import org.apache.tinkerpop.gremlin.process.traversal.Path; //导入方法依赖的package包/类
@Override
public boolean equals(final Object other) {
if (!(other instanceof Path))
return false;
final Path otherPath = (Path) other;
int size = this.size();
if (otherPath.size() != size)
return false;
if (size > 0) {
ImmutablePath currentPathSection = this;
final List<Object> otherObjects = otherPath.objects();
final List<Set<String>> otherLabels = otherPath.labels();
for (int i = otherLabels.size() - 1; i >= 0; i--) {
if (!currentPathSection.currentObject.equals(otherObjects.get(i)))
return false;
if (!currentPathSection.currentLabels.equals(otherLabels.get(i)))
return false;
if (currentPathSection.previousPath instanceof TailPath)
break;
else
currentPathSection = (ImmutablePath) currentPathSection.previousPath;
}
}
return true;
}
示例3: assertPath
import org.apache.tinkerpop.gremlin.process.traversal.Path; //导入方法依赖的package包/类
private static void assertPath(final Traversal<Vertex, Path> traversal) {
int path1 = 0;
int path2 = 0;
int path3 = 0;
while (traversal.hasNext()) {
final Path path = traversal.next();
if (path.size() == 1) {
path1++;
} else if (path.size() == 2) {
path2++;
} else if (path.size() == 3) {
path3++;
} else {
fail("Only path lengths of 1, 2, or 3 should be seen");
}
}
assertEquals(6, path1);
assertEquals(6, path2);
assertEquals(2, path3);
}
示例4: g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_or_loops_isX3XX_hasXname_peterX_path_byXnameX
import org.apache.tinkerpop.gremlin.process.traversal.Path; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
public void g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_or_loops_isX3XX_hasXname_peterX_path_byXnameX() {
final Traversal<Vertex, Path> traversal = get_g_VX1X_repeatXboth_simplePathX_untilXhasXname_peterX_or_loops_isX3XX_hasXname_peterX_path_byXnameX(convertToVertexId("marko"));
printTraversalForm(traversal);
int paths = 0;
boolean has3 = false, has4 = false;
while (traversal.hasNext()) {
final Path path = traversal.next();
switch (path.size()) {
case 3:
assertEquals("marko", path.get(0));
assertEquals("lop", path.get(1));
assertEquals("peter", path.get(2));
has3 = true;
break;
case 4:
assertEquals("marko", path.get(0));
assertEquals("josh", path.get(1));
assertEquals("lop", path.get(2));
assertEquals("peter", path.get(3));
has4 = true;
break;
}
paths++;
}
assertTrue(has3 && has4);
assertEquals(2, paths);
}