Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.pmd.symboltable
Class DummyScope

    java.lang.Object
      net.sourceforge.pmd.symboltable.DummyScope

All Implemented Interfaces:
  Scope

public class DummyScope
extends java.lang.Object
implements Scope

Implementation of Scope for source types that are simpler than java sources. It implements the methods only when necessary not to break at runtime when Violations are handled.

Author:
  pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be

Constructor Summary
`DummyScope()`

Method Summary
`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.
`java.util.Map` | `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 SourceFileScope 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
`java.util.Map` | `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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DummyScope

    public DummyScope()

Method Detail

### getVariableDeclarations

    public java.util.Map getVariableDeclarations()

  Description copied from interface: `Scope`
  Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope

  Specified by:
    `getVariableDeclarations` in interface `Scope`

### getClassDeclarations

    public java.util.Map getClassDeclarations()

  Description copied from interface: `Scope`
  Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that exist at this scope

  Specified by:
    `getClassDeclarations` in interface `Scope`

### addDeclaration

    public void addDeclaration(ClassNameDeclaration decl)

  Description copied from interface: `Scope`
  Add a class declaration to this scope

  Specified by:
    `addDeclaration` in interface `Scope`

### addDeclaration

    public void addDeclaration(VariableNameDeclaration decl)

  Description copied from interface: `Scope`
  Add a variable declaration to this scope

  Specified by:
    `addDeclaration` in interface `Scope`

### addDeclaration

    public void addDeclaration(MethodNameDeclaration decl)

  Description copied from interface: `Scope`
  Add a method declaration to this scope

  Specified by:
    `addDeclaration` in interface `Scope`

### contains

    public boolean contains(NameOccurrence occ)

  Description copied from interface: `Scope`
  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.

  Specified by:
    `contains` in interface `Scope`

### addVariableNameOccurrence

    public NameDeclaration addVariableNameOccurrence(NameOccurrence occ)

  Description copied from interface: `Scope`
  Adds a NameOccurrence to this scope - only call this after getting a true back from contains()

  Specified by:
    `addVariableNameOccurrence` in interface `Scope`

### setParent

    public void setParent(Scope parent)

  Description copied from interface: `Scope`
  Points this scope to its parent

  Specified by:
    `setParent` in interface `Scope`

### getParent

    public Scope getParent()

  Description copied from interface: `Scope`
  Retrieves this scope's parent

  Specified by:
    `getParent` in interface `Scope`

### getEnclosingClassScope

    public ClassScope getEnclosingClassScope()

  Description copied from interface: `Scope`
  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.

  Specified by:
    `getEnclosingClassScope` in interface `Scope`

### getEnclosingSourceFileScope

    public SourceFileScope getEnclosingSourceFileScope()

  Description copied from interface: `Scope`
  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.

  Specified by:
    `getEnclosingSourceFileScope` in interface `Scope`

### getEnclosingMethodScope

    public MethodScope getEnclosingMethodScope()

  Description copied from interface: `Scope`
  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 MethodScope to find a method parameter.

  Specified by:
    `getEnclosingMethodScope` in interface `Scope`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 InfoEther. All Rights Reserved.