antlraux package
v0.2.1

antlraux.context.types
Class MethodType

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

public class MethodType
extends DeclaredType
implements ScopedType, ClassMemberType

This is a basic implementation of MethodType inferface.


Field Summary
protected  Type classType
          The class that holds the method
protected  java.util.LinkedList params
          A list of parameter types
protected  Type returnType
          The method's return type
protected  Scope scope
          Stores the method's scope
 
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
MethodType(int tag, java.lang.String typeName, Type returnType, ClassType classType, Scope s)
           
 
Method Summary
 void addParam(Type type)
           
 void clearParams()
           
 boolean compatibleParamLists(MethodType other)
          Returns true if the two param lists are "compatible" (they have the same length, and every parameter type is compatible with its equivalent in the other list).
 boolean compatibleParams(Type myType, Type hisType)
          Returns true if both myType and hisType implement HeritableType, and hisType.isA(myType) myType.equals(hisType) || hisType.equals(myType)
 boolean compatibleWith(MethodType other)
           
 boolean compatibleWith(MethodType other, boolean compareName, boolean compareReturnType, boolean compareModifiers)
           
 Type getClassType()
           
 Type getReturnType()
           
 Scope getScope()
          Gets the type's scope
 java.util.Enumeration params()
           
 void setClassType(Type classType)
           
 void setReturnType(Type t)
           
 void setScope(Scope s)
          Sets the type's scope
 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.Type
equals, getName, getTag, setName, setTag
 

Field Detail

returnType

protected Type returnType
The method's return type


params

protected java.util.LinkedList params
A list of parameter types


classType

protected Type classType
The class that holds the method


scope

protected Scope scope
Stores the method's scope

Constructor Detail

MethodType

public MethodType(int tag,
                  java.lang.String typeName,
                  Type returnType,
                  ClassType classType,
                  Scope s)
Method Detail

getReturnType

public Type getReturnType()

setReturnType

public void setReturnType(Type t)

params

public java.util.Enumeration params()

addParam

public void addParam(Type type)

clearParams

public void clearParams()

setClassType

public void setClassType(Type classType)
Specified by:
setClassType in interface ClassMemberType

getClassType

public Type getClassType()
Specified by:
getClassType in interface ClassMemberType

getScope

public Scope getScope()
Description copied from interface: ScopedType
Gets the type's scope

Specified by:
getScope in interface ScopedType

setScope

public void setScope(Scope s)
Description copied from interface: ScopedType
Sets the type's scope

Specified by:
setScope in interface ScopedType

compatibleWith

public boolean compatibleWith(MethodType other)

compatibleWith

public boolean compatibleWith(MethodType other,
                              boolean compareName,
                              boolean compareReturnType,
                              boolean compareModifiers)

compatibleParamLists

public boolean compatibleParamLists(MethodType other)
Returns true if the two param lists are "compatible" (they have the same length, and every parameter type is compatible with its equivalent in the other list). We'll say that two param types a and b are compatible if a call to compatibleParams(Type,Type) (CompatibleParams(a,b)) returns true.


compatibleParams

public boolean compatibleParams(Type myType,
                                Type hisType)
Returns true if


toString

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

antlraux package
v0.2.1

Created by Enrique José García Cota