我将枚举作为按顺序遍历树结构的指南(迭代器使用这些枚举常量来决定如何遍历树):
/**
* The result type of an {@link IVisitor} implementation.
*
* @author Johannes Lichtenberger, University of Konstanz
*/
public enum EVisitResult {
/** Continue without visiting the siblings of this node. */
SKIPSIBLINGS,
/** Continue without visiting the descendants of this node. */
SKIPSUBTREE,
/** Continue traversal. */
CONTINUE,
/** Terminate traversal. */
TERMINATE,
/** Pop from the right sibling stack. */
SKIPSUBTREEPOPSTACK
}
然而,最后一个枚举常量仅用于内部访问者,不应该被使用公共 API 的用户使用。有什么想法可以隐藏“SKIPSUBTREEPOPSTACK”吗?