View Javadoc
1 package net.sourceforge.pmd.symboltable; 2 3 import java.util.Map; 4 5 /*** 6 * Provides methods which all scopes must implement 7 * 8 * See JLS 6.3 for a description of scopes 9 */ 10 public interface Scope { 11 12 /*** 13 * Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that 14 * exist and are either used or not used at this scope 15 */ 16 Map getVariableDeclarations(boolean lookingForUsed); 17 18 /*** 19 * Add a variable declaration to this scope 20 */ 21 void addDeclaration(VariableNameDeclaration decl); 22 23 /*** 24 * Add a method declaration to this scope 25 */ 26 void addDeclaration(MethodNameDeclaration decl); 27 28 /*** 29 * Tests whether or not a NameOccurrence is directly contained in the scope 30 * Note that if this search is just in this scope - it doesn't go diving into any 31 * contained scopes. 32 */ 33 boolean contains(NameOccurrence occ); 34 35 /*** 36 * Adds a NameOccurrence to this scope - only call this after getting 37 * a true back from contains() 38 */ 39 NameDeclaration addVariableNameOccurrence(NameOccurrence occ); 40 41 /*** 42 * Points this scope to its parent 43 */ 44 void setParent(Scope parent); 45 46 /*** 47 * Retrieves this scope's parent 48 */ 49 Scope getParent(); 50 51 /*** 52 * Goes searching up the tree for this scope's enclosing ClassScope 53 * This is handy if you're buried down in a LocalScope and need to 54 * hop up to the ClassScope to find a method name. 55 */ 56 ClassScope getEnclosingClassScope(); 57 }

This page was automatically generated by Maven