polyglot.ext.param.types
Class SubstClassType_c

java.lang.Object
  extended by polyglot.ext.jl.types.TypeObject_c
      extended by polyglot.ext.jl.types.Type_c
          extended by polyglot.ext.jl.types.ReferenceType_c
              extended by polyglot.ext.jl.types.ClassType_c
                  extended by polyglot.ext.param.types.SubstClassType_c
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, SubstType, ClassType, Importable, MemberInstance, Named, Qualifier, ReferenceType, Type, TypeObject, Copy
Direct Known Subclasses:
CofferSubstClassType_c

public class SubstClassType_c
extends ClassType_c
implements SubstType

Implementation of a ClassType that performs substitutions using a map. Subclasses must define how the substititions are performed and how to cache substituted types.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface polyglot.types.ClassType
ClassType.Kind
 
Field Summary
protected  ClassType base
          The class type we are substituting into.
protected  Subst subst
          Map from formal parameters (of type Param) to actuals.
 
Fields inherited from class polyglot.ext.jl.types.TypeObject_c
position, ts
 
Fields inherited from interface polyglot.types.ClassType
ANONYMOUS, LOCAL, MEMBER, TOP_LEVEL
 
Constructor Summary
SubstClassType_c(ParamTypeSystem ts, Position pos, ClassType base, Subst subst)
           
 
Method Summary
 Type base()
          Get the class on that we are performing substitutions.
 java.util.List constructors()
          Get the class's constructors.
 java.util.Iterator entries()
          Entries of the underlying substitution object.
 boolean equalsImpl(TypeObject t)
          Type equality test.
 java.util.List fields()
          Get the class's fields.
 Flags flags()
          Get the class's flags.
 java.lang.String fullName()
          Get the class's full name, if possible.
 int hashCode()
          Hash code.
 boolean inStaticContext()
          Get whether the class was declared in a static context
 java.util.List interfaces()
          Get the class's interfaces.
 ClassType.Kind kind()
          Get the class's kind: top-level, member, local, or anonymous.
 java.util.List memberClasses()
          Get the class's member classes.
 java.util.List methods()
          Get the class's methods.
 java.lang.String name()
          Get the class's short name, if possible.
 ClassType outer()
          Get the class's outer class, if a nested class.
 Package package_()
          Get the class's package, if possible.
 Subst subst()
          The substitution object.
 Type superType()
          Get the class's super type.
 java.lang.String toString()
          Yields a string representing this type.
 java.lang.String translate(Resolver c)
          Return a string into which to translate the type.
 
Methods inherited from class polyglot.ext.jl.types.ClassType_c
container, descendsFromImpl, fieldNamed, hasEnclosingInstance, hasEnclosingInstanceImpl, isAnonymous, isCanonical, isCastValidImpl, isClass, isEnclosed, isEnclosedImpl, isImplicitCastValidImpl, isInner, isInnerClass, isLocal, isMember, isNested, isThrowable, isTopLevel, isUncheckedException, memberClassNamed, toClass
 
Methods inherited from class polyglot.ext.jl.types.ReferenceType_c
hasMethod, hasMethodImpl, isReference, methods, methodsNamed, toReference
 
Methods inherited from class polyglot.ext.jl.types.Type_c
arrayOf, arrayOf, descendsFrom, isArray, isBoolean, isByte, isCastValid, isChar, isComparable, isDouble, isFloat, isImplicitCastValid, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPackage, isPrimitive, isShort, isSubtype, isSubtypeImpl, isType, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toArray, toNull, toPackage, toPrimitive, toType
 
Methods inherited from class polyglot.ext.jl.types.TypeObject_c
copy, equals, position, typeSystem
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface polyglot.types.Type
arrayOf, arrayOf, descendsFrom, descendsFromImpl, isArray, isBoolean, isByte, isCastValid, isCastValidImpl, isChar, isClass, isComparable, isDouble, isFloat, isImplicitCastValid, isImplicitCastValidImpl, isInt, isIntOrLess, isLong, isLongOrLess, isNull, isNumeric, isPrimitive, isReference, isShort, isSubtype, isSubtypeImpl, isThrowable, isUncheckedException, isVoid, numericConversionValid, numericConversionValid, numericConversionValidImpl, numericConversionValidImpl, toArray, toClass, toNull, toPrimitive, toReference
 
Methods inherited from interface polyglot.types.Qualifier
isPackage, isType, toPackage, toType
 
Methods inherited from interface polyglot.types.TypeObject
isCanonical, position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 
Methods inherited from interface polyglot.types.ReferenceType
hasMethod, hasMethodImpl, methods, methodsNamed
 

Field Detail

base

protected ClassType base
The class type we are substituting into.


subst

protected Subst subst
Map from formal parameters (of type Param) to actuals.

Constructor Detail

SubstClassType_c

public SubstClassType_c(ParamTypeSystem ts,
                        Position pos,
                        ClassType base,
                        Subst subst)
Method Detail

entries

public java.util.Iterator entries()
Entries of the underlying substitution object.

Specified by:
entries in interface SubstType
Returns:
an Iterator of Map.Entry.

base

public Type base()
Get the class on that we are performing substitutions.

Specified by:
base in interface SubstType

subst

public Subst subst()
The substitution object.

Specified by:
subst in interface SubstType

superType

public Type superType()
Get the class's super type.

Specified by:
superType in interface ReferenceType
Specified by:
superType in class ClassType_c

interfaces

public java.util.List interfaces()
Get the class's interfaces.

Specified by:
interfaces in interface ReferenceType
Specified by:
interfaces in class ClassType_c
Returns:
A list of Type.
See Also:
Type

fields

public java.util.List fields()
Get the class's fields.

Specified by:
fields in interface ReferenceType
Specified by:
fields in class ClassType_c
Returns:
A list of FieldInstance.
See Also:
FieldInstance

methods

public java.util.List methods()
Get the class's methods.

Specified by:
methods in interface ReferenceType
Specified by:
methods in class ClassType_c
Returns:
A list of MethodInstance.
See Also:
MethodInstance

constructors

public java.util.List constructors()
Get the class's constructors.

Specified by:
constructors in interface ClassType
Specified by:
constructors in class ClassType_c
See Also:
ConstructorInstance

memberClasses

public java.util.List memberClasses()
Get the class's member classes.

Specified by:
memberClasses in interface ClassType
Specified by:
memberClasses in class ClassType_c
See Also:
ClassType

outer

public ClassType outer()
Get the class's outer class, if a nested class.

Specified by:
outer in interface ClassType
Specified by:
outer in class ClassType_c

kind

public ClassType.Kind kind()
Get the class's kind: top-level, member, local, or anonymous.

Specified by:
kind in interface ClassType
Specified by:
kind in class ClassType_c

inStaticContext

public boolean inStaticContext()
Get whether the class was declared in a static context

Specified by:
inStaticContext in interface ClassType

fullName

public java.lang.String fullName()
Get the class's full name, if possible.

Specified by:
fullName in interface Named
Overrides:
fullName in class ClassType_c

name

public java.lang.String name()
Get the class's short name, if possible.

Specified by:
name in interface Named
Specified by:
name in class ClassType_c

package_

public Package package_()
Get the class's package, if possible.

Specified by:
package_ in interface Importable
Specified by:
package_ in class ClassType_c

flags

public Flags flags()
Description copied from class: ClassType_c
Get the class's flags.

Specified by:
flags in interface MemberInstance
Specified by:
flags in class ClassType_c

translate

public java.lang.String translate(Resolver c)
Description copied from class: Type_c
Return a string into which to translate the type.

Specified by:
translate in interface Type
Overrides:
translate in class ClassType_c
Parameters:
c - A resolver in which to lookup this type to determine if the type is unique in the given resolver.

equalsImpl

public boolean equalsImpl(TypeObject t)
Type equality test.

Specified by:
equalsImpl in interface TypeObject
Overrides:
equalsImpl in class TypeObject_c
See Also:
TypeObject_c.equalsImpl(TypeObject), Object.hashCode()

hashCode

public int hashCode()
Hash code.

Overrides:
hashCode in class TypeObject_c

toString

public java.lang.String toString()
Description copied from class: Type_c
Yields a string representing this type. The string should be consistent with equality. That is, if this.equals(anotherType), then it should be that this.toString().equals(anotherType.toString()). The string does not have to be a legal Java identifier. It is suggested, but not required, that it be an easily human readable representation, and thus useful in error messages and generated output.

Specified by:
toString in interface Type
Overrides:
toString in class ClassType_c