Search in sources :

Example 6 with JavadocNodeImpl

use of com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl in project checkstyle by checkstyle.

the class JavadocDetailNodeParser method insertChildrenNodes.

/**
     * Creates child nodes for each node from 'nodes' array.
     * @param parseTreeParent original ParseTree parent node
     * @param nodes array of JavadocNodeImpl nodes
     */
private void insertChildrenNodes(final JavadocNodeImpl[] nodes, ParseTree parseTreeParent) {
    for (int i = 0; i < nodes.length; i++) {
        final JavadocNodeImpl currentJavadocNode = nodes[i];
        final ParseTree currentParseTreeNodeChild = parseTreeParent.getChild(i);
        final JavadocNodeImpl[] subChildren = createChildrenNodes(currentJavadocNode, currentParseTreeNodeChild);
        currentJavadocNode.setChildren((DetailNode[]) subChildren);
    }
}
Also used : DetailNode(com.puppycrawl.tools.checkstyle.api.DetailNode) JavadocNodeImpl(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Example 7 with JavadocNodeImpl

use of com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl in project checkstyle by checkstyle.

the class JavadocDetailNodeParser method createJavadocNode.

/**
     * Creates JavadocNodeImpl node on base of ParseTree node.
     *
     * @param parseTree ParseTree node
     * @param parent DetailNode that will be parent of new node
     * @param index child index that has new node
     * @return JavadocNodeImpl node on base of ParseTree node.
     */
private JavadocNodeImpl createJavadocNode(ParseTree parseTree, DetailNode parent, int index) {
    final JavadocNodeImpl node = new JavadocNodeImpl();
    node.setText(parseTree.getText());
    node.setColumnNumber(getColumn(parseTree));
    node.setLineNumber(getLine(parseTree) + blockCommentLineNumber);
    node.setIndex(index);
    node.setType(getTokenType(parseTree));
    node.setParent(parent);
    node.setChildren((DetailNode[]) new JavadocNodeImpl[parseTree.getChildCount()]);
    return node;
}
Also used : DetailNode(com.puppycrawl.tools.checkstyle.api.DetailNode) JavadocNodeImpl(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl)

Aggregations

JavadocNodeImpl (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl)7 DetailNode (com.puppycrawl.tools.checkstyle.api.DetailNode)5 ParseTree (org.antlr.v4.runtime.tree.ParseTree)2 Test (org.junit.Test)1