gov.llnl.babel.symbols

Class Class

Implemented Interfaces:
Comparable, Attributes, Comparable, IMetadata

public class Class
extends Extendable

Class Class defines a sidl class. Most of the basic functionality for this class is implemented by Extendable. This class adds the capability to be extended by a parent class.

Field Summary

Fields inherited from class gov.llnl.babel.symbols.Symbol

CLASS, ENUM, INTERFACE, PACKAGE, SCOPE, STRUCT, d_context, s_type

Fields inherited from class gov.llnl.babel.symbols.SymbolID

SCOPE

Fields inherited from class gov.llnl.babel.symbols.ASTNode

d_frozen

Constructor Summary

Class(SymbolID id, Comment comment, Context context)
Create an empty Class object that will be constructed by calls to other member functions.
Class(SymbolID id, Comment comment, Metadata metadata, Context context)
Create an empty Class object that will be constructed by calls to other member functions.

Method Summary

void
addImplementsAll(Interface iface)
This only adds the interface to the Implmenets-all map, it does not actually implement the methods inside.
void
addParentInterface(Interface parent)
Add a parent interface to this class.
void
addSplicerContents(String location, String name, String impl)
Add the specified contents to the splicer block identified by the location and name.
void
freeze()
boolean
getAbstractModifier()
int
getDepth()
Return how many levels of refinement this type is from a basic type.
Interface
getImplementsAll(SymbolID id)
Map
getImplementsAllMap()
Collection
getOverwrittenClassMethods()
This function returns all the methods that were defined in a parent class, and have been redefined locally.
Class
getParentClass()
Collection
getParents(boolean all)
Return the parent interfaces and parent class (if any) in a Collection.
List
getSplicerBlocks(String location)
Return a list of splicer blocks for the specified location.
List
getSplicerContents(String location, String name)
Return splicer contents for the specified location and splicer name.
boolean
hasImplmentsAll(SymbolID id)
boolean
hasOverwrittenMethods()
boolean
hasParentClass(SymbolID id, boolean all)
Return whether this class has the specified parent class.
boolean
hasStaticMethod(boolean all)
Return whether this class has any static methods.
boolean
isAbstract()
Return whether this class is abstract.
boolean
isInterface()
Return whether this object represents an interface (false).
void
setAbstractModifier(boolean abs)
void
setParentClass(Class parent)

Methods inherited from class gov.llnl.babel.symbols.Extendable

addInvariant, addMethod, addParentData, addParentInterface, addRenamedMethod, freeze, getAbstractAndLocalMethods, getAbstractMethods, getAllInvariants, getAllParentsInOrder, getAllPostconditions, getAllPreconditions, getAllSymbolReferences, getBasicArrayRefs, getInvariants, getMethods, getMethodsWithNonblocking, getNewMethod, getNewMethods, getNonstaticMethods, getNumberAssertions, getNumberInvariants, getNumberOfMethods, getNumberPostconditions, getNumberPreconditions, getObjectDependencies, getOverloadedMethodsByName, getParentInterface, getParentInterfaces, getParents, getRenamedMethod, getRenamedMethodSymbolID, getRenamedMethods, getStaticMethods, getSymbolReferences, hasAncestor, hasAssertions, hasExceptionThrowingMethod, hasInvariants, hasMethodByLongName, hasMethodByShortName, hasParentInterface, hasParentInterfaces, hasReservedMethodAssertion, hasStaticMethod, isAbstract, isInterface, isLocal, lookupMethodByLongName, lookupMethodByShortName, methodWasRenamed, validateAssertions, validateInvariants, validatePostconditions, validatePostconditions, validatePostconditions, validatePreconditions, validatePreconditions, validatePreconditions

Methods inherited from class gov.llnl.babel.symbols.Symbol

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

Methods inherited from class gov.llnl.babel.symbols.SymbolID

compareTo, equals, fromXML, getFullName, getShortName, getShortName, getSymbolName, getVersion, hashCode, setFromXML

Methods inherited from class gov.llnl.babel.symbols.ASTNode

checkFrozen, clone, freeze, protectCollection, protectList, protectMap, protectSet

Constructor Details

Class

public Class(SymbolID id,
             Comment comment,
             Context context)
Create an empty Class object that will be constructed by calls to other member functions.

Class

public Class(SymbolID id,
             Comment comment,
             Metadata metadata,
             Context context)
Create an empty Class object that will be constructed by calls to other member functions.

Method Details

addImplementsAll

public void addImplementsAll(Interface iface)
This only adds the interface to the Implmenets-all map, it does not actually implement the methods inside. This must be done manually.
Parameters:
iface - The Interface itself

addParentInterface

public void addParentInterface(Interface parent)
Add a parent interface to this class. This method does not check that the interfaces and methods are compatible; it simply copies the methods and interface parents and adds them to this interface.
Overrides:
addParentInterface in interface Extendable

addSplicerContents

public void addSplicerContents(String location,
                               String name,
                               String impl)
Add the specified contents to the splicer block identified by the location and name.

freeze

public void freeze()
Overrides:
freeze in interface Extendable

getAbstractModifier

public boolean getAbstractModifier()

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.
Overrides:
getDepth in interface Symbol

getImplementsAll

public Interface getImplementsAll(SymbolID id)

getImplementsAllMap

public Map getImplementsAllMap()

getOverwrittenClassMethods

public Collection getOverwrittenClassMethods()
This function returns all the methods that were defined in a parent class, and have been redefined locally. It will not return methods that were abstract in the parent class, or methods that were inherited from an interface.

getParentClass

public Class getParentClass()

getParents

public Collection getParents(boolean all)
Return the parent interfaces and parent class (if any) in a Collection.
Overrides:
getParents in interface Extendable

getSplicerBlocks

public List getSplicerBlocks(String location)
Return a list of splicer blocks for the specified location.

getSplicerContents

public List getSplicerContents(String location,
                               String name)
Return splicer contents for the specified location and splicer name.

hasImplmentsAll

public boolean hasImplmentsAll(SymbolID id)

hasOverwrittenMethods

public boolean hasOverwrittenMethods()

hasParentClass

public boolean hasParentClass(SymbolID id,
                              boolean all)
Return whether this class has the specified parent class. If the boolean argument is true, then recursively search the inheritance hierarchy.

hasStaticMethod

public boolean hasStaticMethod(boolean all)
Return whether this class has any static methods. If the flag is true, then determines from all locally defined and parent methods.
Overrides:
hasStaticMethod in interface Extendable

isAbstract

public boolean isAbstract()
Return whether this class is abstract. A class is abstract if and only if it has one or more abstract methods.
Overrides:
isAbstract in interface Extendable

isInterface

public boolean isInterface()
Return whether this object represents an interface (false).
Overrides:
isInterface in interface Extendable

setAbstractModifier

public void setAbstractModifier(boolean abs)

setParentClass

public void setParentClass(Class parent)