ca.quine.jcommons.freemind.maputil
Class FoldLargeNodes
java.lang.Object
|
+--ca.quine.jcommons.freemind.maputil.FoldLargeNodes
- All Implemented Interfaces:
- INodeApplicator
- public class FoldLargeNodes
- extends Object
- implements INodeApplicator
Fold (close) nodes with more than the given number of child nodes.
If a node is already folded, then we "trim" the tree (that is, we do not
descend on the node's children).
A parent node with (say) three children, where all of them are folded,
has a count of three regardless of how many children the folded nodes have.
This implementation is not used by MapUtils for
MapUtils.closeLargeNodes(Map, int)
. It is provided as an example
of how "trimming" a tree can be useful (that is, returning
INodeApplicator.SEARCH_TRIM
from the apply
method).
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FoldLargeNodes
public FoldLargeNodes(int maxChildren)
apply
public int apply(Node parentNode,
Node node)
- Specified by:
apply
in interface INodeApplicator
countChildren
protected int countChildren(Node node)
isLeaf
protected boolean isLeaf(Node node)
isFolded
protected boolean isFolded(Node node)