Uses of Interface
cloud.opencode.base.tree.Treeable
Packages that use Treeable
Package
Description
-
Uses of Treeable in cloud.opencode.base.tree
Classes in cloud.opencode.base.tree that implement TreeableMethods in cloud.opencode.base.tree with type parameters of type TreeableModifier and TypeMethodDescriptionBuild tree from flat list (default root detection) 从扁平列表构建树(默认根节点检测)Build tree from flat list with specified root ID 从扁平列表构建树(指定根节点ID)OpenTree.buildTreeSorted(List<T> nodes, ID rootId, Comparator<T> comparator) Build sorted tree 构建排序树static <T extends Treeable<T,?>>
intCalculate tree depth 计算树深度OpenTree.extractSubtree(List<T> roots, ID id) Extract the subtree rooted at the node with the given ID 提取以给定ID节点为根的子树Filter tree (keep matching nodes and their ancestors) 过滤树(保留匹配节点及其祖先)static <T extends Treeable<T,ID>, ID>
TFind node by ID 按ID查找节点Find all nodes matching predicate 查找所有满足条件的节点Find lowest common ancestor of two nodes by ID 通过ID查找两个节点的最近公共祖先OpenTree.flattenTree(List<T> roots) Flatten tree to list 将树扁平化为列表Get all leaf nodes 获取所有叶子节点Get path from root to specified node 获取从根到指定节点的路径OpenTree.getSiblings(List<T> roots, ID id) Get sibling nodes of the node with the given ID 获取给定ID节点的兄弟节点Get tree statistics string 获取树统计字符串static <T extends Treeable<T,ID>, ID>
booleanOpenTree.isSorted(List<T> roots, Comparator<T> comparator) Check if tree is sorted at all levels 检查树在所有层级是否已排序OpenTree.merge(List<T> left, List<T> right, TreeMerger.MergeStrategy<T> strategy) Merge two tree forests with custom conflict resolution 使用自定义冲突解决合并两个树森林OpenTree.mergeKeepLeft(List<T> left, List<T> right) Merge two tree forests, keeping left node on conflict 合并两个树森林,冲突时保留左侧节点OpenTree.mergeKeepRight(List<T> left, List<T> right) Merge two tree forests, keeping right node on conflict 合并两个树森林,冲突时保留右侧节点TreeTraverser.preOrderIterator(List<T> roots) Creates a pre-order iterator for Treeable 创建Treeable的前序迭代器Print tree to string 打印树为字符串Print tree to string with custom formatter 使用自定义格式化器打印树为字符串TreePrinter.printSimple(List<T> roots, String indent, Function<T, String> formatter) Print simple tree (indented format) 打印简单树(缩进格式)TreePrinter.printSingle(T root) Print single node tree 打印单节点树static <T extends Treeable<T,ID>, ID>
voidTreePrinter.printToConsole(List<T> roots) Print tree to console 打印树到控制台static <T extends Treeable<T,ID>, ID>
voidTreePrinter.printToConsole(List<T> roots, Function<T, String> formatter) Print tree to console with formatter 使用格式化器打印树到控制台static <T extends Treeable<T,ID>, ID>
voidTreePrinter.printToStream(List<T> roots, PrintStream out, Function<T, String> formatter) Print tree to stream 打印树到流static <T extends Treeable<T,?>>
intCalculate total node count 计算节点总数static <T extends Treeable<T,ID>, ID>
voidOpenTree.sort(List<T> roots, Comparator<T> comparator) Sort tree recursively using TreeSorter 使用 TreeSorter 递归排序树static <T extends Treeable<T,ID>, ID, U extends Comparable<? super U>>
voidSort tree recursively by extracted key 按提取的键递归排序树static <T extends Treeable<T,?>>
voidOpenTree.sortTree(List<T> nodes, Comparator<T> comparator) Deprecated, for removal: This API element is subject to removal in a future version.static <T extends Treeable<T,ID>, ID>
TreeStatisticsOpenTree.statistics(List<T> roots) Collect comprehensive tree statistics in a single BFS pass 通过单次 BFS 收集全面的树统计Creates a pre-order stream of Treeable nodes 创建Treeable节点的前序流OpenTree.toFlatMaps(List<T> roots) Convert tree to flat list of maps (without hierarchy) 将树扁平化为Map列表(无层级)Serialize tree to JSON 将树序列化为JSONSerialize tree to JSON with custom field extractor 使用自定义字段提取器将树序列化为JSONConvert tree to list of maps 将树转换为Map列表Serialize tree to XML 将树序列化为XMLSerialize tree to XML with custom field extractor 使用自定义字段提取器将树序列化为XMLstatic <T extends Treeable<T,ID>, ID>
booleanTreeTraverser.traverse(List<T> roots, Function<T, TreeTraverser.TraversalControl> visitor) Traverses Treeable nodes with control 带控制的Treeable节点遍历static <T extends Treeable<T,?>>
voidOpenTree.traverseBreadthFirst(List<T> roots, Consumer<T> visitor) Breadth-first (level order) traversal 广度优先(层序)遍历static <T extends Treeable<T,?>>
voidOpenTree.traversePostOrder(List<T> roots, Consumer<T> visitor) Post-order traversal 后序遍历static <T extends Treeable<T,?>>
voidOpenTree.traversePreOrder(List<T> roots, Consumer<T> visitor) Pre-order traversal 前序遍历static <T extends Treeable<T,?>>
voidOpenTree.traverseWithDepth(List<T> roots, BiConsumer<T, Integer> visitor) Traverse with depth information 带深度信息的遍历 -
Uses of Treeable in cloud.opencode.base.tree.builder
Methods in cloud.opencode.base.tree.builder with type parameters of type TreeableModifier and TypeMethodDescriptionBuild tree concurrently 并发构建树Build tree concurrently with root ID 使用根ID并发构建树ConcurrentTreeBuilder.buildLarge(List<T> nodes, ID rootId, int parallelThreshold) Build large tree with parallel processing 使用并行处理构建大型树Convert list to tree 列表转树Convert list to tree with root ID 使用根ID将列表转树ListToTreeConverter.convert(List<T> items, Function<T, ID> idExtractor, Function<T, ID> parentIdExtractor, Function<T, N> nodeFactory) Convert using extractors 使用提取器转换ListToTreeConverter.convertSorted(List<T> nodes, ID rootId, Comparator<T> comparator) Convert list to tree with comparator 使用比较器将列表转树 -
Uses of Treeable in cloud.opencode.base.tree.diff
Methods in cloud.opencode.base.tree.diff with type parameters of type TreeableModifier and TypeMethodDescriptionstatic <T extends Treeable<T,ID>, ID>
TreeDiffResult<T> Compare two trees by ID 通过ID比较两棵树static <T extends Treeable<T,ID>, ID>
TreeDiffResult<T> TreeDiff.diff(List<T> oldRoots, List<T> newRoots, BiPredicate<T, T> equalityChecker) Compare two trees with custom equality 使用自定义相等性比较两棵树static <T extends Treeable<T,ID>, ID, K>
TreeDiffResult<T> TreeDiff.diffByKey(List<T> oldRoots, List<T> newRoots, Function<T, K> keyExtractor, BiPredicate<T, T> equalityChecker) Compare using custom key extractor 使用自定义键提取器比较 -
Uses of Treeable in cloud.opencode.base.tree.operation
Methods in cloud.opencode.base.tree.operation with type parameters of type TreeableModifier and TypeMethodDescriptionstatic <T extends Treeable<T,ID>, ID>
booleanCheck if tree contains node with ID 检查树是否包含指定ID的节点static <T extends Treeable<T,ID>, ID>
intCount all nodes 统计所有节点TreeMapper.extractAll(List<T> roots, Function<T, R> extractor) Extract values from tree 从树中提取值TreeUtil.extractSubtree(List<T> roots, ID id) Extract the subtree rooted at the node with the given ID 提取以给定ID节点为根的子树Filter tree, keeping matching nodes and their ancestors 过滤树,保留匹配节点及其祖先TreeFilter.filterByDepth(List<T> roots, int maxDepth) Filter by depth 按深度过滤TreeFilter.filterFlat(List<T> roots, Predicate<T> predicate) Filter only matching nodes (no ancestor preservation) 仅过滤匹配节点(不保留祖先)TreeFilter.filterWithAncestors(List<T> roots, Predicate<T> predicate) Filter tree keeping ancestors of matching nodes 过滤树保留匹配节点的祖先Find node by predicate 通过谓词查找节点Find all nodes matching predicate 查找所有匹配谓词的节点Find node by ID 通过ID查找节点Flatten tree to list 将树扁平化为列表Get all leaf nodes 获取所有叶子节点static <T extends Treeable<T,ID>, ID>
intTreeUtil.getMaxDepth(List<T> roots) Get max depth 获取最大深度TreeUtil.getSiblings(List<T> roots, ID id) Get sibling nodes of the node with the given ID 获取给定ID节点的兄弟节点static <T extends Treeable<T,ID>, ID>
booleanTreeSorter.isSorted(List<T> roots, Comparator<T> comparator) Check if the tree is sorted at all levels according to the given comparator.Map tree nodes to different type 将树节点映射为不同类型Map tree nodes to different type 将树节点映射为不同类型TreeMapper.mapToAny(List<S> roots, Function<S, T> nodeMapper, BiConsumer<T, List<T>> childrenSetter) Map tree to different structure with custom children mapper 使用自定义子节点映射器将树映射为不同结构TreeMerger.merge(List<T> left, List<T> right, TreeMerger.MergeStrategy<T> strategy) Merges two tree forests using the specified merge strategy.TreeMerger.mergeKeepLeft(List<T> left, List<T> right) Merges two tree forests, keeping the left node on conflict.TreeMerger.mergeKeepRight(List<T> left, List<T> right) Merges two tree forests, keeping the right node on conflict.static <T extends Treeable<T,ID>, ID>
TreeStatisticsCollect statistics from a tree forest in a single BFS pass 通过单次 BFS 遍历从树森林收集统计信息static <T extends Treeable<T,ID>, ID>
voidTreeSorter.sort(List<T> roots, Comparator<T> comparator) Sort children in-place recursively at every level using the given comparator.static <T extends Treeable<T,ID>, ID, U extends Comparable<? super U>>
voidSort children in-place recursively by an extracted comparable key.static <T extends Treeable<T,ID>, ID>
voidTreeSorter.sortReversed(List<T> roots, Comparator<T> comparator) Sort children in-place recursively in reversed order. -
Uses of Treeable in cloud.opencode.base.tree.path
Methods in cloud.opencode.base.tree.path with type parameters of type TreeableModifier and TypeMethodDescriptionPathFinder.findAllLeafPaths(List<T> roots) Find paths to all leaf nodes 查找到所有叶子节点的路径PathFinder.findAllPaths(List<T> roots, Predicate<T> predicate) Find all paths to matching nodes 查找到所有匹配节点的路径PathFinder.findLowestCommonAncestor(List<T> roots, ID id1, ID id2) Find lowest common ancestor of two nodes by ID 通过ID查找两个节点的最近公共祖先PathFinder.findLowestCommonAncestor(List<T> roots, Predicate<T> predicate1, Predicate<T> predicate2) Find lowest common ancestor of two nodes by predicates 通过谓词查找两个节点的最近公共祖先Find path to node matching predicate 查找到匹配谓词的节点的路径PathFinder.findPathById(List<T> roots, ID targetId) Find path to node by ID 通过ID查找到节点的路径PathFinder.getAncestorIds(List<T> roots, ID targetId) Get ancestor IDs for a node 获取节点的祖先ID列表static <T extends Treeable<T,ID>, ID>
intGet depth of node 获取节点深度 -
Uses of Treeable in cloud.opencode.base.tree.serialization
Methods in cloud.opencode.base.tree.serialization with type parameters of type TreeableModifier and TypeMethodDescriptionTreeSerializer.toFlatMaps(List<T> roots) Flatten tree to list of maps (without hierarchy) 将树扁平化为Map列表(无层级)TreeSerializer.toFlatMaps(List<T> roots, TreeSerializer.SerializerConfig config) Flatten tree to list of maps with config 使用配置将树扁平化为Map列表Serialize tree to JSON 将树序列化为JSONTreeSerializer.toJson(List<T> roots, TreeSerializer.SerializerConfig config) Serialize tree to JSON with config 使用配置将树序列化为JSONTreeSerializer.toJsonSingle(T root) Serialize single tree node to JSON 将单个树节点序列化为JSONTreeSerializer.toJsonSingle(T root, TreeSerializer.SerializerConfig config) Serialize single tree node to JSON with config 使用配置将单个树节点序列化为JSONTreeSerializer.toMap(T node) Convert single tree node to map 将单个树节点转换为MapConvert tree to list of maps 将树转换为Map列表TreeSerializer.toMaps(List<T> roots, TreeSerializer.SerializerConfig config) Convert tree to list of maps with config 使用配置将树转换为Map列表Serialize tree to XML 将树序列化为XMLTreeSerializer.toXml(List<T> roots, TreeSerializer.SerializerConfig config) Serialize tree to XML with config 使用配置将树序列化为XMLTreeSerializer.toXmlSingle(T root) Serialize single tree node to XML 将单个树节点序列化为XMLTreeSerializer.toXmlSingle(T root, TreeSerializer.SerializerConfig config) Serialize single tree node to XML with config 使用配置将单个树节点序列化为XML -
Uses of Treeable in cloud.opencode.base.tree.traversal
Methods in cloud.opencode.base.tree.traversal with type parameters of type TreeableModifier and TypeMethodDescriptionCollect all nodes 收集所有节点<T extends Treeable<T,ID>, ID>
voidDepthLimitedTraversal.traverse(List<T> roots, TreeVisitor<T> visitor) <T extends Treeable<T,ID>, ID>
voidIterativeTraversal.traverse(List<T> roots, TreeVisitor<T> visitor) <T extends Treeable<T,ID>, ID>
voidLevelOrderTraversal.traverse(List<T> roots, TreeVisitor<T> visitor) <T extends Treeable<T,ID>, ID>
voidPostOrderTraversal.traverse(List<T> roots, TreeVisitor<T> visitor) <T extends Treeable<T,ID>, ID>
voidPreOrderTraversal.traverse(List<T> roots, TreeVisitor<T> visitor) <T extends Treeable<T,ID>, ID>
voidTreeTraversal.traverse(List<T> roots, TreeVisitor<T> visitor) Traverse tree nodes 遍历树节点default <T extends Treeable<T,ID>, ID>
voidTraverse tree nodes with consumer 使用消费者遍历树节点 -
Uses of Treeable in cloud.opencode.base.tree.validation
Methods in cloud.opencode.base.tree.validation with type parameters of type TreeableModifier and TypeMethodDescriptionstatic <T extends Treeable<T,ID>, ID>
voidCycleDetector.checkNoCycle(List<T> roots) Check for cycle and throw if found 检查循环,如果发现则抛出异常CycleDetector.findCyclePath(List<T> roots) Detect cycle and return path 检测循环并返回路径static <T extends Treeable<T,ID>, ID>
booleanCheck if tree has cycles 检查树是否有循环static <T extends Treeable<T,ID>, ID>
booleanCycleDetector.hasPotentialCycle(List<T> nodes) Check flat list for potential cycles 检查扁平列表中的潜在循环static <T extends Treeable<T,ID>, ID>
TreeNodeValidator.ValidationResultValidate tree nodes 验证树节点static <T extends Treeable<T,ID>, ID>
voidTreeNodeValidator.validateOrThrow(List<T> nodes) Validate and throw if invalid 验证并在无效时抛出异常static <T extends Treeable<T,ID>, ID>
TreeNodeValidator.ValidationResultTreeNodeValidator.validateStructure(List<T> roots) Validate tree structure 验证树结构 -
Uses of Treeable in cloud.opencode.base.tree.virtual
Classes in cloud.opencode.base.tree.virtual that implement Treeable
OpenTree.sort(List, Comparator)instead, which uses iterative depth-safe TreeSorter