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


Java Scope.isIn方法代码示例

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


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

示例1: shouldCheck

import com.puppycrawl.tools.checkstyle.api.Scope; //导入方法依赖的package包/类
/**
 * Whether we should check this node.
 * @param ast a given node.
 * @return whether we should check a given node.
 */
private boolean shouldCheck(final DetailAST ast) {
    final Scope customScope;

    if (ScopeUtils.isInInterfaceOrAnnotationBlock(ast)) {
        customScope = Scope.PUBLIC;
    }
    else {
        final DetailAST mods = ast.findFirstToken(TokenTypes.MODIFIERS);
        customScope = ScopeUtils.getScopeFromMods(mods);
    }
    final Scope surroundingScope = ScopeUtils.getSurroundingScope(ast);

    return customScope.isIn(scope)
        && (surroundingScope == null || surroundingScope.isIn(scope))
        && (excludeScope == null
            || !customScope.isIn(excludeScope)
            || surroundingScope != null
            && !surroundingScope.isIn(excludeScope));
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:25,代码来源:JavadocTypeCheck.java

示例2: shouldCheck

import com.puppycrawl.tools.checkstyle.api.Scope; //导入方法依赖的package包/类
/**
 * Whether we should check this node.
 * @param ast a given node.
 * @return whether we should check a given node.
 */
private boolean shouldCheck(final DetailAST ast) {
    boolean result = false;
    if (!ScopeUtils.isInCodeBlock(ast) && !isIgnored(ast)) {
        Scope customScope = Scope.PUBLIC;
        if (ast.getType() != TokenTypes.ENUM_CONSTANT_DEF
                && !ScopeUtils.isInInterfaceOrAnnotationBlock(ast)) {
            final DetailAST mods = ast.findFirstToken(TokenTypes.MODIFIERS);
            customScope = ScopeUtils.getScopeFromMods(mods);
        }

        final Scope surroundingScope = ScopeUtils.getSurroundingScope(ast);
        result = customScope.isIn(scope) && surroundingScope.isIn(scope)
            && (excludeScope == null
                || !customScope.isIn(excludeScope)
                || !surroundingScope.isIn(excludeScope));
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:24,代码来源:JavadocVariableCheck.java

示例3: shouldCheck

import com.puppycrawl.tools.checkstyle.api.Scope; //导入方法依赖的package包/类
/**
 * Whether we should check this node.
 * 
 * @param aAST
 *            a given node.
 * @return whether we should check a given node.
 */
private boolean shouldCheck(final DetailAST aAST) {
    if (ScopeUtils.inCodeBlock(aAST)) {
        return false;
    }

    final Scope scope;
    if (aAST.getType() == TokenTypes.ENUM_CONSTANT_DEF) {
        scope = Scope.PUBLIC;
    } else {
        final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
        final Scope declaredScope = ScopeUtils.getScopeFromMods(mods);
        scope = ScopeUtils.inInterfaceOrAnnotationBlock(aAST) ? Scope.PUBLIC : declaredScope;
    }

    final Scope surroundingScope = ScopeUtils.getSurroundingScope(aAST);

    return Utilities.isExportedPackage(aAST) && scope.isIn(mScope) && surroundingScope.isIn(mScope)
            && ((mExcludeScope == null) || !scope.isIn(mExcludeScope) || !surroundingScope.isIn(mExcludeScope));
}
 
开发者ID:Adobe-Consulting-Services,项目名称:checkstyle-osgi-checks,代码行数:27,代码来源:ExportedJavadocVariableCheck.java

示例4: shouldCheck

import com.puppycrawl.tools.checkstyle.api.Scope; //导入方法依赖的package包/类
/**
 * Whether we should check this node.
 * @param ast a given node.
 * @return whether we should check a given node.
 */
private boolean shouldCheck(final DetailAST ast) {
    boolean check = false;

    if (ast.getType() == TokenTypes.PACKAGE_DEF) {
        check = getFileContents().inPackageInfo();
    }
    else if (!ScopeUtils.isInCodeBlock(ast)) {
        final Scope customScope;

        if (ScopeUtils.isInInterfaceOrAnnotationBlock(ast)
                || ast.getType() == TokenTypes.ENUM_CONSTANT_DEF) {
            customScope = Scope.PUBLIC;
        }
        else {
            customScope = ScopeUtils.getScopeFromMods(ast.findFirstToken(TokenTypes.MODIFIERS));
        }
        final Scope surroundingScope = ScopeUtils.getSurroundingScope(ast);

        check = customScope.isIn(scope)
                && (surroundingScope == null || surroundingScope.isIn(scope))
                && (excludeScope == null
                    || !customScope.isIn(excludeScope)
                    || surroundingScope != null
                        && !surroundingScope.isIn(excludeScope));
    }
    return check;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:33,代码来源:JavadocStyleCheck.java

示例5: shouldCheck

import com.puppycrawl.tools.checkstyle.api.Scope; //导入方法依赖的package包/类
/**
 * Whether we should check this node.
 *
 * @param ast a given node.
 * @param nodeScope the scope of the node.
 * @return whether we should check a given node.
 */
private boolean shouldCheck(final DetailAST ast, final Scope nodeScope) {
    final Scope surroundingScope = ScopeUtils.getSurroundingScope(ast);

    return (excludeScope == null
            || nodeScope != excludeScope
            && surroundingScope != excludeScope)
        && nodeScope.isIn(scope)
        && surroundingScope.isIn(scope);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:17,代码来源:JavadocMethodCheck.java

示例6: getSurroundingScope

import com.puppycrawl.tools.checkstyle.api.Scope; //导入方法依赖的package包/类
/**
 * Returns the scope of the surrounding "block".
 * @param node the node to return the scope for
 * @return the Scope of the surrounding block
 */
public static Scope getSurroundingScope(DetailAST node) {
    Scope returnValue = null;
    for (DetailAST token = node.getParent();
         token != null;
         token = token.getParent()) {
        final int type = token.getType();
        if (type == TokenTypes.CLASS_DEF
            || type == TokenTypes.INTERFACE_DEF
            || type == TokenTypes.ANNOTATION_DEF
            || type == TokenTypes.ENUM_DEF) {
            final DetailAST mods =
                token.findFirstToken(TokenTypes.MODIFIERS);
            final Scope modScope = getScopeFromMods(mods);
            if (returnValue == null || returnValue.isIn(modScope)) {
                returnValue = modScope;
            }
        }
        else if (type == TokenTypes.LITERAL_NEW) {
            returnValue = Scope.ANONINNER;
            // because Scope.ANONINNER is not in any other Scope
            break;
        }
    }

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

示例7: shouldCheck

import com.puppycrawl.tools.checkstyle.api.Scope; //导入方法依赖的package包/类
/**
 * Whether we should check this node.
 * 
 * @param aAST
 *            a given node.
 * @return whether we should check a given node.
 */
private boolean shouldCheck(final DetailAST aAST) {
    final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
    final Scope declaredScope = ScopeUtils.getScopeFromMods(mods);
    final Scope scope = ScopeUtils.inInterfaceOrAnnotationBlock(aAST) ? Scope.PUBLIC : declaredScope;
    final Scope surroundingScope = ScopeUtils.getSurroundingScope(aAST);

    return Utilities.isExportedPackage(aAST)
            && scope.isIn(mScope)
            && ((surroundingScope == null) || surroundingScope.isIn(mScope))
            && ((mExcludeScope == null) || !scope.isIn(mExcludeScope) || ((surroundingScope != null) && !surroundingScope
                    .isIn(mExcludeScope)));
}
 
开发者ID:Adobe-Consulting-Services,项目名称:checkstyle-osgi-checks,代码行数:20,代码来源:ExportedJavadocTypeCheck.java


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