gov.llnl.babel.symbols
Class Symbol
- Comparable, Attributes, Comparable, IMetadata
public abstract class Symbol
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.
Symbol(SymbolID id, int type, Comment comment, Context context) - Initialize the
Symbol abstact base class by providing
a symbol identifier and its type (one of CLASS, ENUM, INTERFACE, or
PACKAGE, or STRUCT).
|
Symbol(SymbolID id, int type, Comment comment, Metadata metadata, Context context) - Initialize the
Symbol abstract base class by providing
a symbol identifier, a symbol type, a comment, and a metadata object.
|
void | addMetadata(String keyword, String value) - Add a (keyword,value) pair to the metadata for this symbol.
|
void | freeze()
|
abstract Set | getAllSymbolReferences() - Return the symbol references for the whole type hierarchy rooted
with this symbol.
|
String | getAttribute(String key)
|
Set | getAttributes()
|
abstract Set | getBasicArrayRefs() - Return the set of all references to arrays of fundamental types.
|
Comment | getComment() - Return the comment associated with this symbol.
|
int | getDepth() - Return how many levels of refinement this type is from a basic type.
|
Metadata | getMetadata() - Return the metadata associated with this symbol.
|
SymbolID | getSymbolID() - Return the identifier associated with this symbol.
|
abstract 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.
|
String | getSymbolTypeString() - Return the type string associated with this symbol.
|
boolean | getUserSpecified() - Indicate whether this is a user-specified symbol (or one resulting
from dependency resolution)
|
boolean | hasAttribute(String key)
|
boolean | isClass() - Return TRUE if the symbol is a class; otherwise, return FALSE.
|
boolean | isInterface() - Return TRUE if the type of this symbol is an interface; otherwise,
return FALSE.
|
boolean | isPackage() - Return TRUE if the symbol is a package; otherwise, return FALSE.
|
boolean | isStruct() - Return TRUE if the symbol is a class; otherwise, return FALSE.
|
static int | minimumDepth(Collection symbols) - Return the minimum depth for a collection of symbols.
|
void | removeAttribute(String key)
|
void | setAttribute(String key)
|
void | setAttribute(String key, String value)
|
void | setComment(Comment comment) - Alter the comment.
|
void | setUserSpecified(boolean val) - Specify whether this symbol was given by the user on the Babel command line
|
CLASS
public static final int CLASS
ENUM
public static final int ENUM
INTERFACE
public static final int INTERFACE
PACKAGE
public static final int PACKAGE
SCOPE
public static final String SCOPE
STRUCT
public static final int STRUCT
d_context
protected Context d_context
s_type
public static final String[] s_type
Symbol
public Symbol(SymbolID id,
int type,
Comment comment,
Context context)
Initialize the Symbol
abstact base class by providing
a symbol identifier and its type (one of CLASS, ENUM, INTERFACE, or
PACKAGE, or STRUCT). The metadata is constructed using the current date and time.
Symbol
public Symbol(SymbolID id,
int type,
Comment comment,
Metadata metadata,
Context context)
Initialize the Symbol
abstract base class by providing
a symbol identifier, a symbol type, a comment, and a metadata object.
addMetadata
public void addMetadata(String keyword,
String value)
Add a (keyword,value) pair to the metadata for this symbol.
- addMetadata in interface IMetadata
getAllSymbolReferences
public abstract 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 Set getBasicArrayRefs()
Return the set of all references to arrays of fundamental types.
getComment
public Comment getComment()
Return the comment associated with this symbol. The return argument
may be null if no comment was defined.
getDepth
public int getDepth()
Return how many levels of refinement this type is from a basic type.
For enumerations and packages, this returns zero. For classes,
it returns the distance from sidl.BaseClass. For interfaces, it
returns the distance from sidl.BaseInterface.
getSymbolID
public SymbolID getSymbolID()
Return the identifier associated with this symbol.
getSymbolReferences
public abstract 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.
getSymbolType
public int getSymbolType()
Return the type of this symbol, one of CLASS, ENUM, INTERFACE, or
PACKAGE.
getSymbolTypeString
public String getSymbolTypeString()
Return the type string associated with this symbol. The return argument
may be null if no type was defined.
getUserSpecified
public boolean getUserSpecified()
Indicate whether this is a user-specified symbol (or one resulting
from dependency resolution)
isClass
public boolean isClass()
Return TRUE if the symbol is a class; otherwise, return FALSE.
isInterface
public boolean isInterface()
Return TRUE if the type of this symbol is an interface; otherwise,
return FALSE.
isPackage
public boolean isPackage()
Return TRUE if the symbol is a package; otherwise, return FALSE.
isStruct
public boolean isStruct()
Return TRUE if the symbol is a class; otherwise, return FALSE.
minimumDepth
public static int minimumDepth(Collection symbols)
Return the minimum depth for a collection of symbols.
- This will always return a value greater or equal to zero.
setComment
public void setComment(Comment comment)
Alter the comment.
comment
- the new comment.
setUserSpecified
public void setUserSpecified(boolean val)
Specify whether this symbol was given by the user on the Babel command line