Package com.puppycrawl.tools.checkstyle.api

Examples of com.puppycrawl.tools.checkstyle.api.DetailNode


     * @param aParagraphTag Some javadoc.
     * @return Some javadoc.
     */
    private boolean isFirstParagraph(DetailNode aParagraphTag)
    {
        DetailNode previousNode = JavadocUtils.getPreviousSibling(aParagraphTag);
        while (previousNode != null) {
            if (previousNode.getType() == JavadocTokenTypes.TEXT
                    && previousNode.getChildren().length > 1
                || previousNode.getType() != JavadocTokenTypes.LEADING_ASTERISK
                    && previousNode.getType() != JavadocTokenTypes.NEWLINE
                    && previousNode.getType() != JavadocTokenTypes.TEXT)
            {
                return false;
            }
            previousNode = JavadocUtils.getPreviousSibling(previousNode);
        }
View Full Code Here


     * @param aNode Some javadoc.
     * @return Some javadoc.
     */
    private DetailNode getNearestEmptyLine(DetailNode aNode)
    {
        DetailNode newLine = JavadocUtils.getPreviousSibling(aNode);
        while (newLine != null) {
            final DetailNode previousSibling = JavadocUtils.getPreviousSibling(newLine);
            if (newLine.getType() == JavadocTokenTypes.NEWLINE && isEmptyLine(newLine))
            {
                break;
            }
            newLine = previousSibling;
View Full Code Here

     * @param aNewLine Some javadoc.
     * @return Some javadoc.
     */
    private boolean isLastEmptyLine(DetailNode aNewLine)
    {
        DetailNode nextNode = JavadocUtils.getNextSibling(aNewLine);
        while (nextNode != null && nextNode.getType() != JavadocTokenTypes.JAVADOC_TAG) {
            if (nextNode.getType() == JavadocTokenTypes.TEXT
                    && nextNode.getChildren().length > 1
                    || nextNode.getType() == JavadocTokenTypes.HTML_ELEMENT)
            {
                return false;
            }
            nextNode = JavadocUtils.getNextSibling(nextNode);
        }
View Full Code Here

     * @param aJavadocRoot javadoc root node.
     * @return true, if comment has javadoc tags.
     */
    private boolean hasJavadocTags(DetailNode aJavadocRoot)
    {
        final DetailNode javadocTagSection =
                JavadocUtils.findFirstToken(aJavadocRoot, JavadocTokenTypes.JAVADOC_TAG);
        return javadocTagSection != null;
    }
View Full Code Here

     *        the token type to match
     * @return the matching token, or null if no match
     */
    public static DetailNode findFirstToken(DetailNode aNode, int aType)
    {
        DetailNode retVal = null;
        for (DetailNode i = getFirstChild(aNode); i != null; i = getNextSibling(i)) {
            if (i.getType() == aType) {
                retVal = i;
                break;
            }
View Full Code Here

     * @param aType token type
     * @return true if aNode contains any node of aType type among children on any deep level.
     */
    public static boolean branchContains(DetailNode aNode, int aType)
    {
        DetailNode curNode = aNode;
        while (curNode != null) {

            if (aType == curNode.getType()) {
                return true;
            }

            DetailNode toVisit = getFirstChild(curNode);
            while ((curNode != null) && (toVisit == null)) {
                toVisit = getNextSibling(curNode);
                if (toVisit == null) {
                    curNode = curNode.getParent();
                }
View Full Code Here

     * @param aNode DetailNode
     * @return next sibling.
     */
    public static DetailNode getNextSibling(DetailNode aNode)
    {
        final DetailNode parent = aNode.getParent();
        if (parent != null) {
            final int nextSiblingIndex = aNode.getIndex() + 1;
            final DetailNode[] children = parent.getChildren();
            if (nextSiblingIndex <= children.length - 1) {
                return children[nextSiblingIndex];
            }
        }
        return null;
View Full Code Here

     * @param aNode DetailNode
     * @return previous sibling
     */
    public static DetailNode getPreviousSibling(DetailNode aNode)
    {
        final DetailNode parent = aNode.getParent();
        if (parent != null) {
            final int previousSiblingIndex = aNode.getIndex() - 1;
            final DetailNode[] children = parent.getChildren();
            if (previousSiblingIndex >= 0) {
                return children[previousSiblingIndex];
            }
        }
        return null;
View Full Code Here

TOP

Related Classes of com.puppycrawl.tools.checkstyle.api.DetailNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.