gov.llnl.babel.symbols
Class Class

java.lang.Object
  extended by gov.llnl.babel.symbols.ASTNode
      extended by gov.llnl.babel.symbols.SymbolID
          extended by gov.llnl.babel.symbols.Symbol
              extended by gov.llnl.babel.symbols.Extendable
                  extended by gov.llnl.babel.symbols.Class
All Implemented Interfaces:
Attributes, IMetadata, java.lang.Cloneable, java.lang.Comparable

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, d_context, ENUM, INTERFACE, PACKAGE, s_type, SCOPE, STRUCT
 
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(java.lang.String location, java.lang.String name, java.lang.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)
           
 java.util.Map getImplementsAllMap()
           
 java.util.Collection getOverwrittenClassMethods()
          This function returns all the methods that were defined in a parent class, and have been redefined locally.
 Class getParentClass()
           
 java.util.Collection getParents(boolean all)
          Return the parent interfaces and parent class (if any) in a Collection.
 java.util.List getSplicerBlocks(java.lang.String location)
          Return a list of splicer blocks for the specified location.
 java.util.List getSplicerContents(java.lang.String location, java.lang.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
addInvAssertion, addMethod, addParentData, addRenamedMethod, getAbstractAndLocalMethods, getAbstractMethods, getAllInvAssertions, getAllParentsInOrder, getAllPostAssertions, getAllPreAssertions, getAllSymbolReferences, getBasicArrayRefs, getInvClause, getInvClause, getInvDefaultComplexity, getMethods, getMethodsWithNonblocking, getNewMethod, getNewMethods, getNonstaticMethods, getNumberOfMethods, getObjectDependencies, getOverloadedMethodsByName, getParentInterface, getParentInterfaces, getRenamedMethod, getRenamedMethods, getRenamedMethodSymbolID, getStaticMethods, getSymbolReferences, getTotalContractAssertions, getTotalInvAssertions, getTotalPostAssertions, getTotalPreAssertions, hasAncestor, hasBuiltinMethodAssertion, hasContracts, hasExceptionThrowingMethod, hasInvClause, hasMethodByLongName, hasMethodByShortName, hasParentInterface, hasParentInterfaces, hasPostconditions, hasPreconditions, invHasMethodCall, invHasResultOrArg, isLocal, lookupMethodByLongName, lookupMethodByShortName, methodWasRenamed, validateContracts, validateInvClause, validatePostClause, validatePostClause, validatePostClause, validatePreClause, validatePreClause, validatePreClause
 
Methods inherited from class gov.llnl.babel.symbols.Symbol
addMetadata, getAttribute, getAttributes, getComment, getMetadata, getSymbolID, getSymbolType, getSymbolTypeString, getUserSpecified, hasAttribute, isClass, 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, isSymbolBindC, setFromXML
 
Methods inherited from class gov.llnl.babel.symbols.ASTNode
checkFrozen, clone, protectCollection, protectList, protectMap, protectSet
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

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 Detail

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.

Specified by:
isAbstract in class Extendable

setAbstractModifier

public void setAbstractModifier(boolean abs)

getAbstractModifier

public boolean getAbstractModifier()

isInterface

public boolean isInterface()
Return whether this object represents an interface (false).

Specified by:
isInterface in class Extendable

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.

Specified by:
hasStaticMethod in class Extendable
Parameters:
all - If TRUE, then local and parent methods are to be searched; otherwise, only local methods are to be searched.

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

hasImplmentsAll

public boolean hasImplmentsAll(SymbolID id)

getImplementsAllMap

public java.util.Map getImplementsAllMap()

getImplementsAll

public Interface getImplementsAll(SymbolID id)

getOverwrittenClassMethods

public java.util.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.


hasOverwrittenMethods

public boolean hasOverwrittenMethods()

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.

Specified by:
addParentInterface in class Extendable
Parameters:
parent - The parent interface to be added to this object.

setParentClass

public void setParentClass(Class parent)

getParentClass

public Class getParentClass()

getParents

public java.util.Collection getParents(boolean all)
Return the parent interfaces and parent class (if any) in a Collection.

Overrides:
getParents in class Extendable
Parameters:
all - If TRUE, all ancestors are to be returned; otherwise, only direct parents.

getDepth

public int getDepth()
Description copied from class: Symbol
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 class Symbol

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.


addSplicerContents

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


getSplicerContents

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


getSplicerBlocks

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


freeze

public void freeze()
Overrides:
freeze in class Extendable