dpt.symbtab
Class ClassDef

java.lang.Object
  |
  +--dpt.symbtab.Definition
        |
        +--dpt.symbtab.ScopedDef
              |
              +--dpt.symbtab.HasImports
                    |
                    +--dpt.symbtab.ClassDef
Direct Known Subclasses:
DummyClass, PrimitiveDef

class ClassDef
extends HasImports

Definition of a Java class OR interface These are merged together because there are places where we just don't know if something is an interface or class (because we are not looking at the classes/interfaces that are imported.)


Field Summary
(package private) static int CLASS
           
private  int classOrInterface
          The type of object this represents We may not initially know, as a statement like import java.awt.Color _could_ be referring to a class _or_ interface.
(package private) static int EITHER
           
private  JavaVector implementers
          A list of classes that implement this interface (This only applies if this represents an INTERFACE)
(package private) static int INTERFACE
           
private  JavaVector interfaces
          A list of interfaces that this class implements, OR a list of super interfaces for this interface
private  java.util.Vector modifiers
           
private  JavaVector subClasses
          A list of classes that extend this class, OR interfaces that extend this interface
private  ClassDef superClass
          The class from which this class was extended (This only applies if this represents a CLASS)
 
Fields inherited from class dpt.symbtab.HasImports
imports
 
Fields inherited from class dpt.symbtab.ScopedDef
elements, iAmDefaultOrBaseScope, unresolvedStuff
 
Fields inherited from class dpt.symbtab.Definition
definition, name, parentScope, references, ST_CL, ST_FU, ST_FU_EXT, ST_IF, ST_IMPL, ST_IMPORT, ST_PAC, ST_SUB, ST_SUPER, ST_VAR
 
Constructor Summary
(package private) ClassDef()
          Constructor for java.lang.Object This was the easiest way to avoid a nasty endless recursion
(package private) ClassDef(java.lang.String name, Occurrence occ, ClassDef superClass, JavaVector interfaces, ScopedDef parentScope)
           
(package private) ClassDef(java.lang.String name, Occurrence occ, ClassDef superClass, JavaVector interfaces, ScopedDef parentScope, java.util.Vector modifiers)
          Constructor to set up a class
 
Method Summary
(package private)  void addImplementer(ClassDef def)
          Adds a reference to the list of classes that implement this interface
(package private)  void addSubclass(ClassDef subclass)
          Add a reference to a class that extends this class (or an interface that extends this interface
(package private)  JavaVector getImplementers()
          get the list of classes that implement this interface
(package private)  JavaVector getInterfaces()
          Return the list of interfaces that this class implements (or the interfaces that this interface extends)
 java.lang.String GetItem(int TypID)
           
 java.util.Vector GetItems(int TypID, java.lang.String modifier)
           
 java.lang.String GetLocation(int TypID, java.lang.String sName)
           
 java.lang.String GetLocation(int TypID, java.lang.String sName, java.lang.String sSymbol)
           
(package private)  JavaVector getSubClasses()
          return a list of all subclasses/subinterfaces of this
(package private)  ClassDef getSuperClass()
          Return a reference to the superclass of this class
(package private)  boolean isClass()
          Does this represent a Java class?
(package private)  boolean isInterface()
          Does this represent a Java interface?
(package private)  Definition lookup(java.lang.String name, int numParams)
          Lookup a method in the class or its superclasses
 void report(IndentingPrintWriter out)
           
(package private)  void resolveTypes(SymbolTable symbolTable)
          resolve referenced symbols
(package private)  void setInterfaces(JavaVector interfaces)
          Set the list of interfaces that this class implements
(package private)  void setSuperClass(ClassDef superClass)
          set the superclass of this class
(package private)  void setType(int type)
          Specify if this is a class or interface once we know
 
Methods inherited from class dpt.symbtab.HasImports
closeImports, getImports, isTopLevel, openImports, reportImports, setImports
 
Methods inherited from class dpt.symbtab.ScopedDef
add, addUnresolved, GetListItems, GetStringItems, GetStringLocation, hasElements, isDefaultOrBaseScope, reportElements, setDefaultOrBaseScope
 
Methods inherited from class dpt.symbtab.Definition
addReference, ExtractClass, ExtractClass, ExtractName, ExtractPackage, ExtractPackage, getDef, getName, getOccurrence, getParentScope, getQualifiedName, GetReferences, isSuperClassOf, listReferences, lookup, setParentScope, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

CLASS

static final int CLASS

INTERFACE

static final int INTERFACE

EITHER

static final int EITHER

classOrInterface

private int classOrInterface
The type of object this represents We may not initially know, as a statement like import java.awt.Color _could_ be referring to a class _or_ interface. Of course a full implementation of a cross-reference tool would either parse the imports at this point, or read information from the class file...

superClass

private ClassDef superClass
The class from which this class was extended (This only applies if this represents a CLASS)

subClasses

private JavaVector subClasses
A list of classes that extend this class, OR interfaces that extend this interface

interfaces

private JavaVector interfaces
A list of interfaces that this class implements, OR a list of super interfaces for this interface

implementers

private JavaVector implementers
A list of classes that implement this interface (This only applies if this represents an INTERFACE)

modifiers

private java.util.Vector modifiers
Constructor Detail

ClassDef

ClassDef()
Constructor for java.lang.Object This was the easiest way to avoid a nasty endless recursion

ClassDef

ClassDef(java.lang.String name,
         Occurrence occ,
         ClassDef superClass,
         JavaVector interfaces,
         ScopedDef parentScope,
         java.util.Vector modifiers)
Constructor to set up a class

ClassDef

ClassDef(java.lang.String name,
         Occurrence occ,
         ClassDef superClass,
         JavaVector interfaces,
         ScopedDef parentScope)
Method Detail

addImplementer

void addImplementer(ClassDef def)
Adds a reference to the list of classes that implement this interface

addSubclass

void addSubclass(ClassDef subclass)
Add a reference to a class that extends this class (or an interface that extends this interface

getImplementers

JavaVector getImplementers()
get the list of classes that implement this interface

getInterfaces

JavaVector getInterfaces()
Return the list of interfaces that this class implements (or the interfaces that this interface extends)

getSubClasses

JavaVector getSubClasses()
return a list of all subclasses/subinterfaces of this

getSuperClass

ClassDef getSuperClass()
Return a reference to the superclass of this class

isClass

boolean isClass()
Does this represent a Java class?

isInterface

boolean isInterface()
Does this represent a Java interface?

lookup

Definition lookup(java.lang.String name,
                  int numParams)
Lookup a method in the class or its superclasses
Overrides:
lookup in class ScopedDef

GetLocation

public java.lang.String GetLocation(int TypID,
                                    java.lang.String sName,
                                    java.lang.String sSymbol)

GetLocation

public java.lang.String GetLocation(int TypID,
                                    java.lang.String sName)
Overrides:
GetLocation in class Definition

GetItem

public java.lang.String GetItem(int TypID)
Overrides:
GetItem in class Definition

GetItems

public java.util.Vector GetItems(int TypID,
                                 java.lang.String modifier)
Overrides:
GetItems in class Definition

report

public void report(IndentingPrintWriter out)
Overrides:
report in class Definition

resolveTypes

void resolveTypes(SymbolTable symbolTable)
resolve referenced symbols
Overrides:
resolveTypes in class HasImports

setInterfaces

void setInterfaces(JavaVector interfaces)
Set the list of interfaces that this class implements

setSuperClass

void setSuperClass(ClassDef superClass)
set the superclass of this class

setType

void setType(int type)
Specify if this is a class or interface once we know