本文整理汇总了Java中io.vavr.collection.Tree.Node方法的典型用法代码示例。如果您正苦于以下问题:Java Tree.Node方法的具体用法?Java Tree.Node怎么用?Java Tree.Node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vavr.collection.Tree
的用法示例。
在下文中一共展示了Tree.Node方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prettyPrint
import io.vavr.collection.Tree; //导入方法依赖的package包/类
private static <T> void prettyPrint(Tree.Node<T> treeNode, String indent, String indent2, StringBuilder s) {
final String[] lines = treeNode.get().toString().split("\n");
s.append(lines[0]);
for (int i = 1; i < lines.length; i++) {
s.append('\n')
.append(indent2)
.append(lines[i]);
}
for (List<Tree.Node<T>> it = treeNode.getChildren(); it.nonEmpty(); it = it.tail()) {
final boolean isLast = it.tail().isEmpty();
s.append('\n')
.append(indent)
.append(isLast ? "└──" : "├──");
prettyPrint(it.head(), indent + (isLast ? " " : "│ "), indent + (isLast ? " " : "│ "), s);
}
}
示例2: processTree
import io.vavr.collection.Tree; //导入方法依赖的package包/类
private int processTree(Tree<?> tree, String parentLabel, int index) {
Object value = tree.getValue();
String label = "lbl" + index;
labels.put(label, value.toString());
if(parentLabel != null) {
edges.add(parentLabel + " -> " + label);
}
for (Tree.Node<?> child : tree.getChildren()) {
index = processTree(child, label, index + 1);
}
return index;
}
示例3: next
import io.vavr.collection.Tree; //导入方法依赖的package包/类
@Override
public <T> T next(final InstanceType<T> instanceType, final FixtureContract fixture) {
return (T)new Tree.Node(
fixture.create(instanceType.getNestedGenericType1()),
List.empty()
);
}
示例4: nextEmpty
import io.vavr.collection.Tree; //导入方法依赖的package包/类
@Override
public <T> T nextEmpty(final InstanceType<T> instanceType, final FixtureContract fixture) {
return (T) new Tree.Node(
fixture.createDummy(instanceType.getNestedGenericType1()),
List.empty()
);
}
示例5: toTree
import io.vavr.collection.Tree; //导入方法依赖的package包/类
Tree.Node<E> toTree();