Interface PostOrderDfsVisitor<T>
-
- Type Parameters:
T
- Resul of traversal
@Beta @PublicAPI public interface PostOrderDfsVisitor<T>
Function passed for DFS post order traversal.Instances of this interface can be passed to
Util.traversePostOrderDFS(com.chemaxon.clustering.util.PostOrderDfsVisitor, com.chemaxon.clustering.common.IDBasedHierarchicClustering)
An instance of this interface represents the mutable state of a post order DFS tree traversal.
visit(com.chemaxon.clustering.common.IDBasedHierarchicCluster, java.util.List, int)
represents the visit of the clusters.Traversal is done according the order in the structure. Each cluster is visited at most once. Visit invoked as soon as possible: either when all children visited or when children visit skip signalled.
Please note that this interface is marked with
Beta
annotation, so it can be subject of incompatible changes or removal in later releases.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
skipChildTraversal(IDBasedHierarchicCluster cluster, int depth)
Decide if a cluster's children should be traversed.T
visit(IDBasedHierarchicCluster cluster, List<T> childResults, int depth)
Visit a cluster.
-
-
-
Method Detail
-
skipChildTraversal
boolean skipChildTraversal(IDBasedHierarchicCluster cluster, int depth)
Decide if a cluster's children should be traversed.If a child traversal is skipped the the actual cluster is immediately visited by invoking
visit(com.chemaxon.clustering.common.IDBasedHierarchicCluster, java.util.List, int)
- Parameters:
cluster
- Cluster to visitdepth
- Visited node depth, distance from a root (0 for the root, 1 for its immediate children)- Returns:
true
when the given cluster's children should not be traversed.
-
visit
T visit(IDBasedHierarchicCluster cluster, List<T> childResults, int depth)
Visit a cluster.- Parameters:
cluster
- Cluster to visitchildResults
- Immutable list of the result of the children visits or null when children traversal is skipepd bytrue
returned value fromskipChildTraversal(com.chemaxon.clustering.common.IDBasedHierarchicCluster, int)
depth
- Visited node depth, distance from a root (0 for the root, 1 for its immediate children)- Returns:
- Result (to pass to parent visit)
-
-