net.sourceforge.pmd.lang.java.symboltable

## Interface Scope

- All Known Implementing Classes:
    AbstractScope, ClassScope, DummyScope, LocalScope, MethodScope, SourceFileScope

      public interface Scope

  Provides methods which all scopes must implement

  See JLS 6.3 for a description of scopes

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDeclaration(ClassNameDeclaration decl)` Add a class declaration to this scope
    `void` | `addDeclaration(MethodNameDeclaration decl)` Add a method declaration to this scope
    `void` | `addDeclaration(VariableNameDeclaration decl)` Add a variable declaration to this scope
    `NameDeclaration` | `addVariableNameOccurrence(NameOccurrence occ)` Adds a NameOccurrence to this scope - only call this after getting a true back from contains()
    `boolean` | `contains(NameOccurrence occ)` Tests whether or not a NameOccurrence is directly contained in the scope Note that this search is just for this scope - it doesn't go diving into any child scopes.
    `Map<ClassNameDeclaration,List<NameOccurrence>>` | `getClassDeclarations()` Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope
    `ClassScope` | `getEnclosingClassScope()` Goes searching up the tree for this scope's enclosing ClassScope This is handy if you're buried down in a LocalScope and need to hop up to the ClassScope to find a method name.
    `MethodScope` | `getEnclosingMethodScope()` Goes searching up the tree for this scope's enclosing MethodScope This is handy if you're buried down in a LocalScope and need to hop up to the MethodScope to find a method parameter.
    `SourceFileScope` | `getEnclosingSourceFileScope()` Goes searching up the tree for this scope's enclosing SourceFileScope This is handy if you're buried down in a LocalScope and need to hop up to the SourceFileScope to find a class name.
    `Scope` | `getParent()` Retrieves this scope's parent
    `Map<VariableNameDeclaration,List<NameOccurrence>>` | `getVariableDeclarations()` Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope
    `void` | `setParent(Scope parent)` Points this scope to its parent

- - ### Method Detail

    - #### getVariableDeclarations

          Map<VariableNameDeclaration,List<NameOccurrence>> getVariableDeclarations()

      Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope

    - #### getClassDeclarations

          Map<ClassNameDeclaration,List<NameOccurrence>> getClassDeclarations()

      Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope

    - #### addDeclaration

          void addDeclaration(ClassNameDeclaration decl)

      Add a class declaration to this scope

    - #### addDeclaration

          void addDeclaration(VariableNameDeclaration decl)

      Add a variable declaration to this scope

    - #### addDeclaration

          void addDeclaration(MethodNameDeclaration decl)

      Add a method declaration to this scope

    - #### contains

          boolean contains(NameOccurrence occ)

      Tests whether or not a NameOccurrence is directly contained in the scope Note that this search is just for this scope - it doesn't go diving into any child scopes.

    - #### addVariableNameOccurrence

          NameDeclaration addVariableNameOccurrence(NameOccurrence occ)

      Adds a NameOccurrence to this scope - only call this after getting a true back from contains()

    - #### setParent

          void setParent(Scope parent)

      Points this scope to its parent

    - #### getParent

          Scope getParent()

      Retrieves this scope's parent

    - #### getEnclosingClassScope

          ClassScope getEnclosingClassScope()

      Goes searching up the tree for this scope's enclosing ClassScope This is handy if you're buried down in a LocalScope and need to hop up to the ClassScope to find a method name.

    - #### getEnclosingSourceFileScope

          SourceFileScope getEnclosingSourceFileScope()

      Goes searching up the tree for this scope's enclosing SourceFileScope This is handy if you're buried down in a LocalScope and need to hop up to the SourceFileScope to find a class name.

    - #### getEnclosingMethodScope

          MethodScope getEnclosingMethodScope()

      Goes searching up the tree for this scope's enclosing MethodScope This is handy if you're buried down in a LocalScope and need to hop up to the MethodScope to find a method parameter.

Copyright © 2002-2013 InfoEther. All Rights Reserved.