当前位置: 首页>>代码示例>>Java>>正文


Java JavadocTokenTypes.TEXT属性代码示例

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes.TEXT属性的典型用法代码示例。如果您正苦于以下问题:Java JavadocTokenTypes.TEXT属性的具体用法?Java JavadocTokenTypes.TEXT怎么用?Java JavadocTokenTypes.TEXT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes的用法示例。


在下文中一共展示了JavadocTokenTypes.TEXT属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isFirstParagraph

/**
 * Determines whether or not the line with paragraph tag is first line in javadoc.
 * @param paragraphTag paragraph tag.
 * @return true, if line with paragraph tag is first line in javadoc.
 */
private static boolean isFirstParagraph(DetailNode paragraphTag) {
    boolean result = true;
    DetailNode previousNode = JavadocUtils.getPreviousSibling(paragraphTag);
    while (previousNode != null) {
        if (previousNode.getType() == JavadocTokenTypes.TEXT
                && !CommonUtils.isBlank(previousNode.getText())
            || previousNode.getType() != JavadocTokenTypes.LEADING_ASTERISK
                && previousNode.getType() != JavadocTokenTypes.NEWLINE
                && previousNode.getType() != JavadocTokenTypes.TEXT) {
            result = false;
            break;
        }
        previousNode = JavadocUtils.getPreviousSibling(previousNode);
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:21,代码来源:JavadocParagraphCheck.java

示例2: visitJavadocToken

@Override
public void visitJavadocToken(DetailNode ast) {
    if (!isInlineDescription(ast)) {
        final List<DetailNode> textNodes = getAllNewlineNodes(ast);
        for (DetailNode newlineNode : textNodes) {
            final DetailNode textNode = JavadocUtils.getNextSibling(JavadocUtils
                    .getNextSibling(newlineNode));
            if (textNode != null && textNode.getType() == JavadocTokenTypes.TEXT) {
                final String text = textNode.getText();
                if (!CommonUtils.isBlank(text.trim())
                        && (text.length() <= offset
                                || !text.substring(1, offset + 1).trim().isEmpty())) {
                    log(textNode.getLineNumber(), MSG_KEY, offset);
                }
            }
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:18,代码来源:JavadocTagContinuationIndentationCheck.java

示例3: printTree

public static void printTree(DetailNode aRoot)
{

    if (aRoot.getChildren().length != 0) {
        for (DetailNode node : aRoot.getChildren()) {
            System.out.println(getLevel(node) + node.toString()
                    + " : ["
                    + node.getText().replaceAll("\n", "\\\\n").replaceAll("\r", "\\\\r")
                    .replaceAll("\t", "\\\\t")
                    + "]");

            if (node.getType() == JavadocTokenTypes.TEXT) {
                continue;
            }

            printTree(node);
        }
    }
}
 
开发者ID:checkstyle,项目名称:contribution,代码行数:19,代码来源:JavadocTreePrinter.java

示例4: getStringInsideTag

/**
 * Concatenates string within text of html tags.
 * @param result javadoc string
 * @param detailNode javadoc tag node
 * @return java doc tag content appended in result
 */
private static String getStringInsideTag(String result, DetailNode detailNode) {
    final StringBuilder contents = new StringBuilder(result);
    DetailNode tempNode = detailNode;
    while (tempNode != null) {
        if (tempNode.getType() == JavadocTokenTypes.TEXT) {
            contents.append(tempNode.getText());
        }
        tempNode = JavadocUtils.getNextSibling(tempNode);
    }
    return contents.toString();
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:17,代码来源:SummaryJavadocCheck.java

示例5: checkEmptyLine

/**
 * Determines whether or not the next line after empty line has paragraph tag in the beginning.
 * @param newline NEWLINE node.
 */
private void checkEmptyLine(DetailNode newline) {
    final DetailNode nearestToken = getNearestNode(newline);
    if (!isLastEmptyLine(newline) && nearestToken.getType() == JavadocTokenTypes.TEXT
            && !CommonUtils.isBlank(nearestToken.getText())) {
        log(newline.getLineNumber(), MSG_TAG_AFTER);
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:11,代码来源:JavadocParagraphCheck.java

示例6: isEmptyLine

/**
 * Determines whether or not the line is empty line.
 * @param newLine NEWLINE node.
 * @return true, if line is empty line.
 */
private static boolean isEmptyLine(DetailNode newLine) {
    boolean result = false;
    DetailNode previousSibling = JavadocUtils.getPreviousSibling(newLine);
    if (previousSibling != null
            && previousSibling.getParent().getType() == JavadocTokenTypes.JAVADOC) {
        if (previousSibling.getType() == JavadocTokenTypes.TEXT
                && CommonUtils.isBlank(previousSibling.getText())) {
            previousSibling = JavadocUtils.getPreviousSibling(previousSibling);
        }
        result = previousSibling != null
                && previousSibling.getType() == JavadocTokenTypes.LEADING_ASTERISK;
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:JavadocParagraphCheck.java

示例7: isLastEmptyLine

/**
 * Tests if NEWLINE node is a last node in javadoc.
 * @param newLine NEWLINE node.
 * @return true, if NEWLINE node is a last node in javadoc.
 */
private static boolean isLastEmptyLine(DetailNode newLine) {
    boolean result = true;
    DetailNode nextNode = JavadocUtils.getNextSibling(newLine);
    while (nextNode != null && nextNode.getType() != JavadocTokenTypes.JAVADOC_TAG) {
        if (nextNode.getType() == JavadocTokenTypes.TEXT
                && !CommonUtils.isBlank(nextNode.getText())
                || nextNode.getType() == JavadocTokenTypes.HTML_ELEMENT) {
            result = false;
            break;
        }
        nextNode = JavadocUtils.getNextSibling(nextNode);
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:JavadocParagraphCheck.java

示例8: convertParseTreeToDetailNode

/**
 * Converts ParseTree (that is generated by ANTLRv4) to DetailNode tree.
 *
 * @param parseTreeNode root node of ParseTree
 * @return root of DetailNode tree
 * @noinspection SuspiciousArrayCast
 */
private DetailNode convertParseTreeToDetailNode(ParseTree parseTreeNode) {
    final JavadocNodeImpl rootJavadocNode = createRootJavadocNode(parseTreeNode);

    JavadocNodeImpl currentJavadocParent = rootJavadocNode;
    ParseTree parseTreeParent = parseTreeNode;

    while (currentJavadocParent != null) {
        // remove unnecessary children tokens
        if (currentJavadocParent.getType() == JavadocTokenTypes.TEXT) {
            currentJavadocParent
                    .setChildren((DetailNode[]) JavadocNodeImpl.EMPTY_DETAIL_NODE_ARRAY);
        }

        final JavadocNodeImpl[] children =
                (JavadocNodeImpl[]) currentJavadocParent.getChildren();

        insertChildrenNodes(children, parseTreeParent);

        if (children.length > 0) {
            currentJavadocParent = children[0];
            parseTreeParent = parseTreeParent.getChild(0);
        }
        else {
            JavadocNodeImpl nextJavadocSibling = (JavadocNodeImpl) JavadocUtils
                    .getNextSibling(currentJavadocParent);

            ParseTree nextParseTreeSibling = getNextSibling(parseTreeParent);

            if (nextJavadocSibling == null) {
                JavadocNodeImpl tempJavadocParent =
                        (JavadocNodeImpl) currentJavadocParent.getParent();

                ParseTree tempParseTreeParent = parseTreeParent.getParent();

                while (nextJavadocSibling == null && tempJavadocParent != null) {

                    nextJavadocSibling = (JavadocNodeImpl) JavadocUtils
                            .getNextSibling(tempJavadocParent);

                    nextParseTreeSibling = getNextSibling(tempParseTreeParent);

                    tempJavadocParent = (JavadocNodeImpl) tempJavadocParent.getParent();
                    tempParseTreeParent = tempParseTreeParent.getParent();
                }
            }
            currentJavadocParent = nextJavadocSibling;
            parseTreeParent = nextParseTreeSibling;
        }
    }

    return rootJavadocNode;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:59,代码来源:JavadocDetailNodeParser.java

示例9: getRequiredJavadocTokens

@Override
public int[] getRequiredJavadocTokens() {
    return new int[] {JavadocTokenTypes.TEXT};
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:4,代码来源:AbstractJavadocCheckTest.java

示例10: convertParseTreeToDetailNode

/**
 * Converts ParseTree (that is generated by ANTLRv4) to DetailNode tree.
 *
 * @param parseTreeNode root node of ParseTree
 * @return root of DetailNode tree
 * @noinspection SuspiciousArrayCast
 */
private DetailNode convertParseTreeToDetailNode(ParseTree parseTreeNode) {
    final JavadocNodeImpl rootJavadocNode = createRootJavadocNode(parseTreeNode);

    JavadocNodeImpl currentJavadocParent = rootJavadocNode;
    ParseTree parseTreeParent = parseTreeNode;

    while (currentJavadocParent != null) {
        // remove unnecessary children tokens
        if (currentJavadocParent.getType() == JavadocTokenTypes.TEXT) {
            currentJavadocParent
                    .setChildren((DetailNode[]) JavadocNodeImpl.EMPTY_DETAIL_NODE_ARRAY);
        }

        final JavadocNodeImpl[] children =
                (JavadocNodeImpl[]) currentJavadocParent.getChildren();

        insertChildrenNodes(children, parseTreeParent);

        if (children.length > 0) {
            currentJavadocParent = children[0];
            parseTreeParent = parseTreeParent.getChild(0);
        }
        else {
            JavadocNodeImpl nextJavadocSibling = (JavadocNodeImpl) JavadocUtils
                    .getNextSibling(currentJavadocParent);

            ParseTree nextParseTreeSibling = getNextSibling(parseTreeParent);

            if (nextJavadocSibling == null) {
                JavadocNodeImpl tempJavadocParent =
                        (JavadocNodeImpl) currentJavadocParent.getParent();

                ParseTree tempParseTreeParent = parseTreeParent.getParent();

                while (nextJavadocSibling == null && tempJavadocParent != null) {
                    nextJavadocSibling = (JavadocNodeImpl) JavadocUtils
                            .getNextSibling(tempJavadocParent);

                    nextParseTreeSibling = getNextSibling(tempParseTreeParent);

                    tempJavadocParent = (JavadocNodeImpl) tempJavadocParent.getParent();
                    tempParseTreeParent = tempParseTreeParent.getParent();
                }
            }
            currentJavadocParent = nextJavadocSibling;
            parseTreeParent = nextParseTreeSibling;
        }
    }

    return rootJavadocNode;
}
 
开发者ID:checkstyle,项目名称:checkstyle,代码行数:58,代码来源:JavadocDetailNodeParser.java


注:本文中的com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes.TEXT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。