gov.llnl.babel.symbols
public abstract class Symbol extends SymbolID implements java.lang.Comparable, Attributes, IMetadata
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.Modifier and Type | Field and Description |
---|---|
static int |
CLASS |
protected Context |
d_context |
static int |
ENUM |
static int |
INTERFACE |
static int |
PACKAGE |
static java.lang.String[] |
s_type |
static java.lang.String |
SCOPE |
static int |
STRUCT |
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
void |
addMetadata(java.lang.String keyword,
java.lang.String value)
Add a (keyword,value) pair to the metadata for this symbol.
|
void |
freeze() |
abstract java.util.Set |
getAllSymbolReferences()
Return the symbol references for the whole type hierarchy rooted
with this symbol.
|
java.lang.String |
getAttribute(java.lang.String key) |
java.util.Set |
getAttributes() |
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.
|
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 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.
|
boolean |
getUserSpecified()
Indicate whether this is a user-specified symbol (or one resulting
from dependency resolution)
|
boolean |
hasAttribute(java.lang.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(java.util.Collection symbols)
Return the minimum depth for a collection of symbols.
|
void |
removeAttribute(java.lang.String key) |
void |
setAttribute(java.lang.String key) |
void |
setAttribute(java.lang.String key,
java.lang.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
|
compareTo, equals, fromXML, getFullName, getShortName, getShortName, getSymbolName, getVersion, hashCode, isSymbolBindC, setFromXML
checkFrozen, clone, protectCollection, protectList, protectMap, protectSet
public static final int ENUM
public static final int STRUCT
public static final int CLASS
public static final int INTERFACE
public static final int PACKAGE
public static final java.lang.String[] s_type
public static final java.lang.String SCOPE
protected Context d_context
public Symbol(SymbolID id, int type, Comment comment, Context context)
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.public Comment getComment()
public void setComment(Comment comment)
comment
- the new comment.public boolean getUserSpecified()
public int getDepth()
public static int minimumDepth(java.util.Collection symbols)
public void setUserSpecified(boolean val)
public Metadata getMetadata()
getMetadata
in interface IMetadata
public void addMetadata(java.lang.String keyword, java.lang.String value)
addMetadata
in interface IMetadata
public SymbolID getSymbolID()
public int getSymbolType()
public boolean isPackage()
public boolean isInterface()
public boolean isClass()
public boolean isStruct()
public java.lang.String getSymbolTypeString()
public abstract java.util.Set getSymbolReferences()
SymbolID
)
referenced by this particular symbol. The return argument may be
null if this symbol contains no external references.public abstract java.util.Set getAllSymbolReferences()
public abstract java.util.Set getBasicArrayRefs()
public boolean hasAttribute(java.lang.String key)
hasAttribute
in interface Attributes
public java.lang.String getAttribute(java.lang.String key)
getAttribute
in interface Attributes
public void setAttribute(java.lang.String key)
setAttribute
in interface Attributes
public void setAttribute(java.lang.String key, java.lang.String value)
setAttribute
in interface Attributes
public java.util.Set getAttributes()
getAttributes
in interface Attributes
public void removeAttribute(java.lang.String key) throws UnknownAttributeException
removeAttribute
in interface Attributes
UnknownAttributeException