antlraux package
v0.2.1

antlraux.context.types
Class ClassType

java.lang.Object
  |
  +--antlraux.context.types.CommonType
        |
        +--antlraux.context.types.DeclaredType
              |
              +--antlraux.context.types.ClassType
All Implemented Interfaces:
HeritableType, ModifiedType, ScopedType, SimpleInheritanceType, Type

public class ClassType
extends DeclaredType
implements ModifiedType, ScopedType, SimpleInheritanceType

This class represents a Type that modelizes the type of a class, this is, a set of data and a set of methods.

It implements ModifiedType, so it can deal with modifiers like "public", "protected", etc.

It supports simple inheritance thanks to the implementation of SimpleInheritanceType.

Since it also implements ScopedType, it contains a referente to an instance of Scope. It is in that instance of scope that the represented class' attributes (data, not methods) are stored. It is in this scope where all methods and attributes should be.


Field Summary
protected  Scope scope
          The scope where attribute definitions will be stored
protected  ClassType superType
          The Type of this Type's class super class :)
 
Fields inherited from class antlraux.context.types.DeclaredType
modifiers
 
Fields inherited from class antlraux.context.types.CommonType
name, tag
 
Fields inherited from interface antlraux.context.types.Type
DEFAULT_NAME, DEFAULT_TAG
 
Constructor Summary
ClassType(int tag, java.lang.String typeName, ClassType superType, Scope s)
           
 
Method Summary
 void addSuperClassAttributes(int attributesTag)
           
 void addSuperClassMethods(int methodTag)
           
 Scope getScope()
          Accessor for scope
 SimpleInheritanceType getSuperType()
          Accessor for superType
 boolean isA(HeritableType superType)
           
 Declaration searchCompatibleMethod(int methodTag, MethodType mt)
           
 void setScope(Scope s)
          Accessor for scope
 void setSuperType(SimpleInheritanceType superType)
          Accessor for superType
 java.lang.String toString()
           
 
Methods inherited from class antlraux.context.types.DeclaredType
addModifier, clearModifiers, compareModifiers, equals, hasModifier, modifiers, modifiersSet
 
Methods inherited from class antlraux.context.types.CommonType
getName, getTag, setName, setTag
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface antlraux.context.types.ModifiedType
addModifier, clearModifiers, compareModifiers, hasModifier, modifiers, modifiersSet
 
Methods inherited from interface antlraux.context.types.Type
equals, getName, getTag, setName, setTag
 

Field Detail

superType

protected ClassType superType
The Type of this Type's class super class :)


scope

protected Scope scope
The scope where attribute definitions will be stored

Constructor Detail

ClassType

public ClassType(int tag,
                 java.lang.String typeName,
                 ClassType superType,
                 Scope s)
Method Detail

getSuperType

public SimpleInheritanceType getSuperType()
Accessor for superType

Specified by:
getSuperType in interface SimpleInheritanceType

setSuperType

public void setSuperType(SimpleInheritanceType superType)
                  throws TypeException
Accessor for superType

Specified by:
setSuperType in interface SimpleInheritanceType
Parameters:
superType - the new super class
Throws:
TypeException - if (superType!=null and is not an instance of ClassType) or if superType.isA(this)
See Also:
HeritableType.isA(HeritableType)

getScope

public Scope getScope()
Accessor for scope

Specified by:
getScope in interface ScopedType

setScope

public void setScope(Scope s)
Accessor for scope

Specified by:
setScope in interface ScopedType

isA

public boolean isA(HeritableType superType)
Specified by:
isA in interface HeritableType

toString

public java.lang.String toString()
Specified by:
toString in interface Type
Overrides:
toString in class DeclaredType

addSuperClassAttributes

public void addSuperClassAttributes(int attributesTag)
                             throws ContextException
ContextException

addSuperClassMethods

public void addSuperClassMethods(int methodTag)
                          throws ContextException
ContextException

searchCompatibleMethod

public Declaration searchCompatibleMethod(int methodTag,
                                          MethodType mt)

antlraux package
v0.2.1

Created by Enrique José García Cota