gov.llnl.babel.symbols
Class Symbol

java.lang.Object
  |
  +--gov.llnl.babel.symbols.Symbol
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
Enumeration, Extendable, Package

public abstract class Symbol
extends java.lang.Object
implements java.lang.Comparable

The Symbol abstract base class describes the basic characteristics shared by all symbols in the symbol table. All SIDL symbols have a symbol identifier, a symbol type, a metadata description, and an associated comment. Four different types of symbols are supported: package, enum, class, and interface.


Field Summary
static int CLASS
           
static int ENUM
           
static int INTERFACE
           
static int PACKAGE
           
static java.lang.String[] s_type
           
static java.lang.String SCOPE
           
 
Constructor Summary
Symbol(SymbolID id, int type, Comment comment)
          Initialize the Symbol abstact base class by providing a symbol identifier and its type (one of CLASS, ENUM, INTERFACE, or PACKAGE).
Symbol(SymbolID id, int type, Comment comment, Metadata metadata)
          Initialize the Symbol abstract base class by providing a symbol identifier, a symbol type, a comment, and a metadata object.
 
Method Summary
 void addMetadata(java.lang.String keyword, java.lang.String value)
          Add a (keyword,value) pair to the metadata for this symbol.
 int compareTo(java.lang.Object o)
          Compare this Symbol with the argument passed in.
abstract  java.util.Set getAllSymbolReferences()
          Return the symbol references for the whole type hierarchy rooted with this symbol.
abstract  java.util.Set getBasicArrayRefs()
          Return the set of all references to arrays of fundamental types.
 Comment getComment()
          Return the comment associated with this symbol.
 java.lang.String getFullName()
          Return the fully qualified name associated with this symbol.
 Metadata getMetadata()
          Return the metadata associated with this symbol.
 SymbolID getSymbolID()
          Return the identifier associated with this symbol.
abstract  java.util.Set getSymbolReferences()
          Return the set of symbols (in the form of SymbolID) referenced by this particular symbol.
 int getSymbolType()
          Return the type of this symbol, one of CLASS, ENUM, INTERFACE, or PACKAGE.
 java.lang.String getSymbolTypeString()
          Return the type string associated with this symbol.
 void setComment(Comment comment)
          Alter the comment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENUM

public static final int ENUM
See Also:
Constant Field Values

CLASS

public static final int CLASS
See Also:
Constant Field Values

INTERFACE

public static final int INTERFACE
See Also:
Constant Field Values

PACKAGE

public static final int PACKAGE
See Also:
Constant Field Values

s_type

public static final java.lang.String[] s_type

SCOPE

public static final java.lang.String SCOPE
See Also:
Constant Field Values
Constructor Detail

Symbol

public Symbol(SymbolID id,
              int type,
              Comment comment)
Initialize the Symbol abstact base class by providing a symbol identifier and its type (one of CLASS, ENUM, INTERFACE, or PACKAGE). The metadata is constructed using the current date and time.


Symbol

public Symbol(SymbolID id,
              int type,
              Comment comment,
              Metadata metadata)
Initialize the Symbol abstract base class by providing a symbol identifier, a symbol type, a comment, and a metadata object.

Method Detail

getComment

public Comment getComment()
Return the comment associated with this symbol. The return argument may be null if no comment was defined.


setComment

public void setComment(Comment comment)
Alter the comment.

Parameters:
comment - the new comment.

getMetadata

public Metadata getMetadata()
Return the metadata associated with this symbol.


addMetadata

public void addMetadata(java.lang.String keyword,
                        java.lang.String value)
Add a (keyword,value) pair to the metadata for this symbol.


getSymbolID

public SymbolID getSymbolID()
Return the identifier associated with this symbol.


getFullName

public java.lang.String getFullName()
Return the fully qualified name associated with this symbol.


getSymbolType

public int getSymbolType()
Return the type of this symbol, one of CLASS, ENUM, INTERFACE, or PACKAGE.


getSymbolTypeString

public java.lang.String getSymbolTypeString()
Return the type string associated with this symbol. The return argument may be null if no type was defined.


getSymbolReferences

public abstract java.util.Set getSymbolReferences()
Return the set of symbols (in the form of SymbolID) referenced by this particular symbol. The return argument may be null if this symbol contains no external references.


getAllSymbolReferences

public abstract java.util.Set getAllSymbolReferences()
Return the symbol references for the whole type hierarchy rooted with this symbol. For packages, this recurses down the package hierarchy.


getBasicArrayRefs

public abstract java.util.Set getBasicArrayRefs()
Return the set of all references to arrays of fundamental types.


compareTo

public int compareTo(java.lang.Object o)
Compare this Symbol with the argument passed in.

Specified by:
compareTo in interface java.lang.Comparable