Class RequireThisCheck.AbstractFrame

    • Field Detail

      • varIdents

        private final java.util.Set<DetailAST> varIdents
        Set of name of variables declared in this frame.
      • frameNameIdent

        private final DetailAST frameNameIdent
        Name identifier token.
    • Constructor Detail

      • AbstractFrame

        protected AbstractFrame​(RequireThisCheck.AbstractFrame parent,
                                DetailAST ident)
        Constructor -- invokable only via super() from subclasses.
        Parameters:
        parent - parent frame.
        ident - frame name ident.
    • Method Detail

      • addIdent

        private void addIdent​(DetailAST identToAdd)
        Add a name to the frame.
        Parameters:
        identToAdd - the name we're adding.
      • getFrameName

        protected java.lang.String getFrameName()
      • getFrameNameIdent

        public DetailAST getFrameNameIdent()
      • containsFieldOrVariable

        protected boolean containsFieldOrVariable​(DetailAST nameToFind)
        Check whether the frame contains a field or a variable with the given name.
        Parameters:
        nameToFind - the IDENT ast of the name we're looking for.
        Returns:
        whether it was found.
      • getIfContains

        protected RequireThisCheck.AbstractFrame getIfContains​(DetailAST nameToFind,
                                                               boolean lookForMethod)
        Check whether the frame contains a given name.
        Parameters:
        nameToFind - IDENT ast of the name we're looking for.
        lookForMethod - whether we are looking for a method name.
        Returns:
        whether it was found.
      • containsFieldOrVariableDef

        protected boolean containsFieldOrVariableDef​(java.util.Set<DetailAST> set,
                                                     DetailAST ident)
        Whether the set contains a declaration with the text of the specified IDENT ast and it is declared in a proper position.
        Parameters:
        set - the set of declarations.
        ident - the specified IDENT ast.
        Returns:
        true if the set contains a declaration with the text of the specified IDENT ast and it is declared in a proper position.
      • isProperDefinition

        protected boolean isProperDefinition​(DetailAST ident,
                                             DetailAST ast)
        Whether the definition is correspondent to the IDENT.
        Parameters:
        ident - the IDENT ast to check.
        ast - the IDENT ast of the definition to check.
        Returns:
        true if ast is correspondent to ident.
      • checkPosition

        private static boolean checkPosition​(DetailAST ast1,
                                             DetailAST ast2)
        Whether the declaration is located before the checked ast.
        Parameters:
        ast1 - the IDENT ast of the declaration.
        ast2 - the IDENT ast to check.
        Returns:
        true, if the declaration is located before the checked ast.