Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.checks.usage.transmogrify
Class SymbolTable  view SymbolTable download SymbolTable.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.checks.usage.transmogrify.SymbolTable

public class SymbolTable
extends java.lang.Object

this class contains all of the definitions, references, and scopes created by the system. Other stuff this class does:


Field Summary
private  BaseScope baseScope
           
private  java.io.File currentFile
           
private  int currentLine
           
private  ScopeIndex index
           
private  java.util.Hashtable packages
           
private  SymTabAST root
           
private  java.util.Stack scopes
           
 
Constructor Summary
SymbolTable(SymTabAST root)
          constructor takes SymTabAST
 
Method Summary
 void defineBlock(BlockDef blockDef)
          defines a block within the symbol table
 void defineClass(ClassDef def)
          defines a class in the symbol table.
 void defineLabel(LabelDef labelDef)
          defines a label within the symbol table
 void defineMethod(MethodDef method)
          defines a method in the symbol table
 void definePackage(PackageDef pkg, Scope parent)
          adds PackageDef to its parent scope and stores the PackageDef in packages
 void defineVariable(VariableDef v)
          defines a variable in the symbol table
 BaseScope getBaseScope()
          returns the "base" scope
 java.io.File getCurrentFile()
          gets the file that the symbol table is currently processing
 Scope getCurrentScope()
          returns the current scope.
 PackageDef getPackage(java.lang.String name)
          gets package by its name
 java.util.Hashtable getPackages()
          gets all packages stored in this symbol table
 ScopeIndex getScopeIndex()
          gets the symbol table's scope index
 SymTabAST getTree()
          gets the root node
 void indexScope(Scope scope)
          places a scope in the symbol table's index
 Scope popScope()
          pops a scope from the stack.
 void pushScope(Scope scope)
          pushes a new scope onto the stack
 void setCurrentFile(java.io.File file)
          sets the current file that the symbol table is processing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packages

private java.util.Hashtable packages

scopes

private java.util.Stack scopes

index

private ScopeIndex index

currentFile

private java.io.File currentFile

currentLine

private int currentLine

baseScope

private BaseScope baseScope

root

private SymTabAST root
Constructor Detail

SymbolTable

public SymbolTable(SymTabAST root)
constructor takes SymTabAST

Method Detail

getTree

public SymTabAST getTree()
gets the root node


getBaseScope

public BaseScope getBaseScope()
returns the "base" scope


getCurrentScope

public Scope getCurrentScope()
returns the current scope. Scopes are nested in a stack (FIFO queue) and pushed/popped based on the structure of the AST


pushScope

public void pushScope(Scope scope)
pushes a new scope onto the stack


popScope

public Scope popScope()
pops a scope from the stack.


getPackages

public java.util.Hashtable getPackages()
gets all packages stored in this symbol table


getPackage

public PackageDef getPackage(java.lang.String name)
gets package by its name


definePackage

public void definePackage(PackageDef pkg,
                          Scope parent)
adds PackageDef to its parent scope and stores the PackageDef in packages


defineClass

public void defineClass(ClassDef def)
defines a class in the symbol table.


defineMethod

public void defineMethod(MethodDef method)
defines a method in the symbol table


defineVariable

public void defineVariable(VariableDef v)
defines a variable in the symbol table


defineBlock

public void defineBlock(BlockDef blockDef)
defines a block within the symbol table


defineLabel

public void defineLabel(LabelDef labelDef)
defines a label within the symbol table


indexScope

public void indexScope(Scope scope)
places a scope in the symbol table's index


getScopeIndex

public ScopeIndex getScopeIndex()
gets the symbol table's scope index


setCurrentFile

public void setCurrentFile(java.io.File file)
sets the current file that the symbol table is processing


getCurrentFile

public java.io.File getCurrentFile()
gets the file that the symbol table is currently processing