gov.llnl.babel.symbols
Class Enumeration
- Comparable, Attributes, Comparable, IMetadata
The Enumeration
class represents a collection of enumerated
symbols with specified integer values. Values for enumeration symbols not
specified by the user are assigned values in an arbitrary fashion.
void | addEnumerator(String name, Comment comment) - Add a new enumerator without a specified value.
|
void | addEnumerator(String name, int value, boolean from_user) - Add a new enumerator with a specified value.
|
void | addEnumerator(String name, int value, boolean from_user, Comment comment) - Add a new enumerator with a specified value.
|
void | addEnumerator(String name, int value, Comment comment) - Add a new enumerator with a specified value.
|
boolean | definedByUser(String name) - Return whether the specified enumerator name was defined by the
user (true) or given a value (false).
|
void | freeze()
|
Set | getAllSymbolReferences()
|
Set | getBasicArrayRefs() - Return a null object that represents the external basic arrays
references by this enumerated type.
|
Comment | getEnumeratorComment(String name) - Return the comment, if any, for the specified enumerated name.
|
int | getEnumeratorValue(String name) - Return the value for the specified enumerated name.
|
List | getEnumerators() - Return the list of enumerators as a sorted list.
|
Iterator | getIterator() - Return an
Iterator that will iterate over the elements
of the enumeration.
|
Set | getSymbolReferences() - Return a null object that represents the external symbols referenced
by this enumerated type.
|
boolean | hasEnumerator(String name) - Return whether the current enumeration contains an enumerator with
the specified name.
|
addMetadata , freeze , getAllSymbolReferences , getAttribute , getAttributes , getBasicArrayRefs , getComment , getDepth , getMetadata , getSymbolID , getSymbolReferences , getSymbolType , getSymbolTypeString , getUserSpecified , hasAttribute , isClass , isInterface , isPackage , isStruct , minimumDepth , removeAttribute , setAttribute , setAttribute , setComment , setUserSpecified |
Enumeration
public Enumeration(SymbolID id,
Comment comment,
Context context)
Create a new Enumeration
with the specified symbol
identifier and comment.
Enumeration
public Enumeration(SymbolID id,
Comment comment,
Metadata metadata,
Context context)
Create a new Enumeration
with the specified symbol
identifier, comment, and metadata.
addEnumerator
public void addEnumerator(String name,
Comment comment)
Add a new enumerator without a specified value. If a previous
enumerator exists with the same name, then this enumerator will
replace the previous one. This enumerator will be assigned a
value when its value is requested.
addEnumerator
public void addEnumerator(String name,
int value,
boolean from_user)
Add a new enumerator with a specified value. The flag indicates
whether the value was assigned by the user or by the parser.
addEnumerator
public void addEnumerator(String name,
int value,
boolean from_user,
Comment comment)
Add a new enumerator with a specified value. The flag indicates
whether the value was assigned by the user or by the parser.
If a previous enumerator exists with the same name, then this
enumerator will replace the previous one.
addEnumerator
public void addEnumerator(String name,
int value,
Comment comment)
Add a new enumerator with a specified value. If a previous enumerator
exists with the same name, then this enumerator will replace the
previous one.
definedByUser
public boolean definedByUser(String name)
Return whether the specified enumerator name was defined by the
user (true) or given a value (false). If the specified name is
not part of this enumerated collection, then return false.
getBasicArrayRefs
public Set getBasicArrayRefs()
Return a null object that represents the external basic arrays
references by this enumerated type.
- getBasicArrayRefs in interface Symbol
getEnumeratorComment
public Comment getEnumeratorComment(String name)
Return the comment, if any, for the specified enumerated name.
getEnumeratorValue
public int getEnumeratorValue(String name)
Return the value for the specified enumerated name. If the name
was not previously defined, then assign it a unique integer value.
getEnumerators
public List getEnumerators()
Return the list of enumerators as a sorted list. Each element of the
list is an element of the enumeration, each of which is a string.
getIterator
public Iterator getIterator()
Return an Iterator
that will iterate over the elements
of the enumeration. The iterator will iterate over the names of the
elements of the enumeration, each of which is a string.
getSymbolReferences
public Set getSymbolReferences()
Return a null object that represents the external symbols referenced
by this enumerated type.
- getSymbolReferences in interface Symbol
hasEnumerator
public boolean hasEnumerator(String name)
Return whether the current enumeration contains an enumerator with
the specified name.