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