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 TableMaker  view TableMaker download TableMaker.java

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

public class TableMaker
extends java.lang.Object

this is the class that does the work of the "walking" step -- going through the SymTabAST and constructing the definitions and references. The SymTabAST is constructed in a DOMish fashion, i.e. each node knows about its first child and its next sibling. The DFS search is carried out by two functions -- walkTree, which deals with a single SymTabAST node, and walkSibilngs, which deals with all the siblings of an SymTabAST node.


Nested Class Summary
(package private)  class TableMaker.CatchFinisher
           
(package private)  class TableMaker.ClassFinisher
           
(package private)  class TableMaker.DefinitionFinisher
          Superclass for different kind of XXXFinisher subclass
(package private)  class TableMaker.MethodFinisher
          Completes a Variable by setting all required references
(package private)  class TableMaker.VariableFinisher
          Completes a Variable by setting all required references
 
Field Summary
private  SymTabAST _tree
           
private  java.io.File currentFile
           
private  java.util.Vector imports
           
private  SymbolTable symbolTable
           
 
Constructor Summary
TableMaker(SymTabAST tree)
          Constructor for the TableMaker class
 
Method Summary
private  void clearImports()
          clears the imports member
private  void createDefinitions()
          walks the tree and finishes creating definitions.
private  PackageDef createPackage(SymTabAST tree)
          gets the package represented by the tree.
private  void finishCreatingChildren(Scope scope)
          iterates through all the definitions in the Scope finishes creating each Scope.
private  void finishCreatingDefinition(Definition def)
          begins at the base of the Table and starts finishing definition creation.
private  void finishCreatingDefinitions()
          finishes up creating definitions process starts at the base of the Table
static SymTabAST getExtendsNode(ClassDef classDef)
          returns the SymTabAST that contains the parameter classDef's extends nodes
private  PackageDef getPackage(Scope parent, SymTabAST tree)
          gets the package determined by the tree and parent package def.
 SymbolTable getTable()
          returns the SymbolTable that has been constructed by this TableMaker
 SymTabAST getTree()
          returns the SymTabAST which is the SymTabAST generated from the parsed Java Source files.
private  BlockDef makeBlock(SymTabAST tree)
          creates a new BlockDef in the SymbolTable
 void makeClass(java.lang.String name, SymTabAST tree)
          creates ClassDef for the current class node and add it to the symbol table
 void makeElseBlock(SymTabAST tree)
          defines an anonymous block to enclose the scope of an else block
 VariableDef makeVariableDef(SymTabAST tree, Scope scope)
          creates VariableDef based on the current tree node and scope
 void processAnonymousInnerClass(SymTabAST objblock, SymTabAST classExtended)
          processes anonymous inner class encountered in the tree
 void processAssert(SymTabAST tree)
           
 void processBlock(SymTabAST tree, boolean makeAnonymousScopes)
          processes the current tree node as BlockDef
 void processClass(SymTabAST tree)
          process the given SymTabAST as a class definition
 void processConstructorDef(SymTabAST tree)
          process the given SymTabAST as a constructor definition
 void processElse(SymTabAST tree)
          process the given SymTabAST as an else block
 void processFile(SymTabAST tree)
          process the given SymTabAST as a file definition
 void processFinally(SymTabAST tree)
          process the given SymTabAST as a finally block
 void processFor(SymTabAST tree)
          process the given SymTabAST as a for block
 void processIf(SymTabAST tree)
          process the given SymTabAST as an if block
 void processImplicitPackage(java.io.File file)
          processes a java class that use default no package
 void processImport(SymTabAST tree)
          adds the given SymTabAST to imports member
 void processLabel(SymTabAST tree)
          process the given SymTabAST as a label definition
 void processMethodDef(SymTabAST tree)
          process the given SymTabAST as a method definition
 void processPackage(SymTabAST tree)
          processes the given SymTabAST as a package defintion
 void processTry(SymTabAST tree)
          process the given SymTabAST as a try block
private  void processVariableDef(SymTabAST tree)
          process the given SymTabAST as a variable definition
private  void resolveReferences()
          resolves SymbolTable using Resolver
 void setCurrentFile(java.lang.String fileName)
          set the current file to the named file
 void walkSiblings(SymTabAST tree, boolean makeAnonymousScopes)
          processes the given SymTabAST and each of its siblings
 void walkTree()
          starts walking the SymTabAST
 void walkTree(SymTabAST tree, boolean makeAnonymousScopes)
          processes a single SymTabAST node based on its type and passes of its children for further processing where appropriate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbolTable

private SymbolTable symbolTable

_tree

private SymTabAST _tree

currentFile

private java.io.File currentFile

imports

private java.util.Vector imports
Constructor Detail

TableMaker

public TableMaker(SymTabAST tree)
Constructor for the TableMaker class

Method Detail

getTree

public SymTabAST getTree()
returns the SymTabAST which is the SymTabAST generated from the parsed Java Source files.


getTable

public SymbolTable getTable()
                     throws SymbolTableException
returns the SymbolTable that has been constructed by this TableMaker


createDefinitions

private void createDefinitions()
                        throws SymbolTableException
walks the tree and finishes creating definitions.


finishCreatingDefinitions

private void finishCreatingDefinitions()
                                throws SymbolTableException
finishes up creating definitions process starts at the base of the Table


finishCreatingDefinition

private void finishCreatingDefinition(Definition def)
                               throws SymbolTableException
begins at the base of the Table and starts finishing definition creation.


finishCreatingChildren

private void finishCreatingChildren(Scope scope)
                             throws SymbolTableException
iterates through all the definitions in the Scope finishes creating each Scope.


resolveReferences

private void resolveReferences()
resolves SymbolTable using Resolver


walkTree

public void walkTree()
starts walking the SymTabAST


walkTree

public void walkTree(SymTabAST tree,
                     boolean makeAnonymousScopes)
processes a single SymTabAST node based on its type and passes of its children for further processing where appropriate.


processAssert

public void processAssert(SymTabAST tree)

walkSiblings

public void walkSiblings(SymTabAST tree,
                         boolean makeAnonymousScopes)
processes the given SymTabAST and each of its siblings


processPackage

public void processPackage(SymTabAST tree)
processes the given SymTabAST as a package defintion


processImplicitPackage

public void processImplicitPackage(java.io.File file)
processes a java class that use default no package


createPackage

private PackageDef createPackage(SymTabAST tree)
gets the package represented by the tree. The method analyzes the tree, constructs an appropriate package name and fetches it from the internal package list. If the package does not exist it is created.


getPackage

private PackageDef getPackage(Scope parent,
                              SymTabAST tree)
gets the package determined by the tree and parent package def. The method analyzes the tree and parent scope and retrieves the appropriate package definition from the internal package list. If the package does not exist it is created.


processFile

public void processFile(SymTabAST tree)
process the given SymTabAST as a file definition


processImport

public void processImport(SymTabAST tree)
adds the given SymTabAST to imports member


clearImports

private void clearImports()
clears the imports member


processLabel

public void processLabel(SymTabAST tree)
process the given SymTabAST as a label definition


processClass

public void processClass(SymTabAST tree)
process the given SymTabAST as a class definition


makeClass

public void makeClass(java.lang.String name,
                      SymTabAST tree)
creates ClassDef for the current class node and add it to the symbol table


processAnonymousInnerClass

public void processAnonymousInnerClass(SymTabAST objblock,
                                       SymTabAST classExtended)
processes anonymous inner class encountered in the tree


processVariableDef

private void processVariableDef(SymTabAST tree)
process the given SymTabAST as a variable definition


makeVariableDef

public VariableDef makeVariableDef(SymTabAST tree,
                                   Scope scope)
creates VariableDef based on the current tree node and scope


processTry

public void processTry(SymTabAST tree)
process the given SymTabAST as a try block


processFinally

public void processFinally(SymTabAST tree)
process the given SymTabAST as a finally block


processMethodDef

public void processMethodDef(SymTabAST tree)
process the given SymTabAST as a method definition


processConstructorDef

public void processConstructorDef(SymTabAST tree)
process the given SymTabAST as a constructor definition


processFor

public void processFor(SymTabAST tree)
process the given SymTabAST as a for block


processIf

public void processIf(SymTabAST tree)
process the given SymTabAST as an if block


processElse

public void processElse(SymTabAST tree)
process the given SymTabAST as an else block


makeElseBlock

public void makeElseBlock(SymTabAST tree)
defines an anonymous block to enclose the scope of an else block


processBlock

public void processBlock(SymTabAST tree,
                         boolean makeAnonymousScopes)
processes the current tree node as BlockDef


setCurrentFile

public void setCurrentFile(java.lang.String fileName)
set the current file to the named file


makeBlock

private BlockDef makeBlock(SymTabAST tree)
creates a new BlockDef in the SymbolTable


getExtendsNode

public static SymTabAST getExtendsNode(ClassDef classDef)
returns the SymTabAST that contains the parameter classDef's extends nodes