jklustor-all-api-0.0.7-20140619012755 (ChemAxon)


com.chemaxon.clustering.util
Interface PostOrderDfsVisitor<T>

Type Parameters:
T - Resul of traversal

@Beta
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.

Author:
Gabor Imre
See Also:
http://en.wikipedia.org/wiki/Tree_traversal#Post-order

Method Summary
 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 visit
depth - 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 visit
childResults - Immutable list of the result of the children visits or null when children traversal is skipepd by true returned value from skipChildTraversal(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)

jklustor-all-api-0.0.7-20140619012755 (ChemAxon)