@Exported public class DocTreeScanner<R,P> extends Object implements DocTreeVisitor<R,P>
The default implementation of the visitXYZ methods will determine a result as follows:
scan
on that child. The child may be a simple node
or itself a list of nodes.
scan
each child in turn, and then combining the
result of each scan after the first with the cumulative result
so far, as determined by the reduce(R, R)
method. Each child may be either
a simple node of a list of nodes. The default behavior of the reduce
method is such that the result of the visitXYZ method will be the result of
the last child scanned.
Here is an example to count the number of erroneous nodes in a tree:
class CountErrors extends DocTreeScanner<Integer,Void> { @Override public Integer visitErroneous(ErroneousTree node, Void p) { return 1; } @Override public Integer reduce(Integer r1, Integer r2) { return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2); } }
Constructor and Description |
---|
DocTreeScanner() |
public R reduce(R r1, R r2)
public R visitAttribute(AttributeTree node, P p)
visitAttribute
in interface DocTreeVisitor<R,P>
public R visitAuthor(AuthorTree node, P p)
visitAuthor
in interface DocTreeVisitor<R,P>
public R visitComment(CommentTree node, P p)
visitComment
in interface DocTreeVisitor<R,P>
public R visitDeprecated(DeprecatedTree node, P p)
visitDeprecated
in interface DocTreeVisitor<R,P>
public R visitDocComment(DocCommentTree node, P p)
visitDocComment
in interface DocTreeVisitor<R,P>
public R visitDocRoot(DocRootTree node, P p)
visitDocRoot
in interface DocTreeVisitor<R,P>
public R visitEndElement(EndElementTree node, P p)
visitEndElement
in interface DocTreeVisitor<R,P>
public R visitEntity(EntityTree node, P p)
visitEntity
in interface DocTreeVisitor<R,P>
public R visitErroneous(ErroneousTree node, P p)
visitErroneous
in interface DocTreeVisitor<R,P>
public R visitIdentifier(IdentifierTree node, P p)
visitIdentifier
in interface DocTreeVisitor<R,P>
public R visitInheritDoc(InheritDocTree node, P p)
visitInheritDoc
in interface DocTreeVisitor<R,P>
public R visitLink(LinkTree node, P p)
visitLink
in interface DocTreeVisitor<R,P>
public R visitLiteral(LiteralTree node, P p)
visitLiteral
in interface DocTreeVisitor<R,P>
public R visitParam(ParamTree node, P p)
visitParam
in interface DocTreeVisitor<R,P>
public R visitReference(ReferenceTree node, P p)
visitReference
in interface DocTreeVisitor<R,P>
public R visitReturn(ReturnTree node, P p)
visitReturn
in interface DocTreeVisitor<R,P>
public R visitSee(SeeTree node, P p)
visitSee
in interface DocTreeVisitor<R,P>
public R visitSerial(SerialTree node, P p)
visitSerial
in interface DocTreeVisitor<R,P>
public R visitSerialData(SerialDataTree node, P p)
visitSerialData
in interface DocTreeVisitor<R,P>
public R visitSerialField(SerialFieldTree node, P p)
visitSerialField
in interface DocTreeVisitor<R,P>
public R visitSince(SinceTree node, P p)
visitSince
in interface DocTreeVisitor<R,P>
public R visitStartElement(StartElementTree node, P p)
visitStartElement
in interface DocTreeVisitor<R,P>
public R visitText(TextTree node, P p)
visitText
in interface DocTreeVisitor<R,P>
public R visitThrows(ThrowsTree node, P p)
visitThrows
in interface DocTreeVisitor<R,P>
public R visitUnknownBlockTag(UnknownBlockTagTree node, P p)
visitUnknownBlockTag
in interface DocTreeVisitor<R,P>
public R visitUnknownInlineTag(UnknownInlineTagTree node, P p)
visitUnknownInlineTag
in interface DocTreeVisitor<R,P>
public R visitValue(ValueTree node, P p)
visitValue
in interface DocTreeVisitor<R,P>
public R visitVersion(VersionTree node, P p)
visitVersion
in interface DocTreeVisitor<R,P>
public R visitOther(DocTree node, P p)
visitOther
in interface DocTreeVisitor<R,P>
Copyright © 2005, 2018, Oracle and/or its affiliates. All rights reserved.