/** * Checks if this scope is a subscope of another scope. * Example: PUBLIC is a subscope of PRIVATE. * * @param scope a {@code Scope} value * @return if {@code this} is a subscope of {@code scope}. */ public boolean isIn(Scope scope) { return compareTo(scope) <= 0; }
/** * Checks if given modifiers are valid in substate of given * state({@code Scope}), if it is it updates substate or else it * logs violation. * @param modifiersAst modifiers to process * @param state current state * @param isStateValid is main state for given modifiers is valid */ private void processModifiersSubState(DetailAST modifiersAst, ScopeState state, boolean isStateValid) { final Scope access = ScopeUtil.getScopeFromMods(modifiersAst); if (state.declarationAccess.compareTo(access) > 0) { if (isStateValid && !ignoreModifiers && !isForwardReference(modifiersAst.getParent())) { log(modifiersAst, MSG_ACCESS); } } else { state.declarationAccess = access; } }
/** * Checks if this scope is a subscope of another scope. * Example: PUBLIC is a subscope of PRIVATE. * * @param scope a {@code Scope} value * @return if {@code this} is a subscope of {@code scope}. */ public boolean isIn(Scope scope) { return compareTo(scope) <= 0; }
/** * Checks if given modifiers are valid in substate of given * state({@code Scope}), if it is it updates substate or else it * logs violation. * @param modifiersAst modifiers to process * @param state current state * @param isStateValid is main state for given modifiers is valid */ private void processModifiersSubState(DetailAST modifiersAst, ScopeState state, boolean isStateValid) { final Scope access = ScopeUtil.getScopeFromMods(modifiersAst); if (state.declarationAccess.compareTo(access) > 0) { if (isStateValid && !ignoreModifiers && !isForwardReference(modifiersAst.getParent())) { log(modifiersAst, MSG_ACCESS); } } else { state.declarationAccess = access; } }