gov.llnl.babel.symbols
Class Class

java.lang.Object
  extended by gov.llnl.babel.symbols.ASTNode
      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.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, ENUM, INTERFACE, PACKAGE, s_type, SCOPE, STRUCT
 
Constructor Summary
Class(SymbolID id, Comment comment)
          Create an empty Class object that will be constructed by calls to other member functions.
Class(SymbolID id, Comment comment, Metadata metadata)
          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.
 boolean getAbstractModifier()
           
 int getDepth()
          Return how many levels of refinement this type is from a basic type.
 Interface getImplementsAll(SymbolID id)
           
 java.util.Map getImplmentsAllMap()
           
 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.
 boolean hasImplmentsAll(SymbolID id)
           
 boolean hasOverwrittenMethods()
           
 boolean hasParentClass(SymbolID id, boolean all)
           
 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, addRenamedMethod, getAbstractAndLocalMethods, getAbstractMethods, getAllInvariants, getAllParentsInOrder, getAllPostconditions, getAllPreconditions, getAllSymbolReferences, getBasicArrayRefs, getExceptionSets, getInvariants, getMethods, getNewMethod, getNewMethods, getNonstaticMethods, getNumberAssertions, getNumberInvariants, getNumberOfMethods, getNumberPostconditions, getNumberPreconditions, getObjectDependencies, getOverloadedMethodsByName, getParentInterface, getParentInterfaces, getRenamedMethod, getRenamedMethods, getRenamedMethodSymbolID, getStaticMethods, getSymbolReferences, hasAncestor, hasAssertions, hasExceptionThrowingMethod, hasInvariants, hasMethodByLongName, hasMethodByShortName, hasParentInterface, hasReservedMethodAssertion, isLocal, lookupMethodByLongName, lookupMethodByShortName, methodWasRenamed, validateAssertions, validateInvariants, validatePostconditions, validatePostconditions, validatePostconditions, validatePreconditions, validatePreconditions, validatePreconditions
 
Methods inherited from class gov.llnl.babel.symbols.Symbol
addMetadata, compareTo, getAttribute, getAttributes, getComment, getFullName, getMetadata, getSymbolID, getSymbolType, getSymbolTypeString, getUserSpecified, hasAttribute, isPackage, minimumDepth, removeAttribute, setAttribute, setAttribute, setComment, setUserSpecified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Class

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


Class

public Class(SymbolID id,
             Comment comment,
             Metadata metadata)
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)

getImplmentsAllMap

public java.util.Map getImplmentsAllMap()

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)