jltools.ext.jl.types
Class Type_c

java.lang.Object
  |
  +--jltools.ext.jl.types.TypeObject_c
        |
        +--jltools.ext.jl.types.Type_c
All Implemented Interfaces:
java.lang.Cloneable, Copy, Qualifier, java.io.Serializable, Type, TypeObject
Direct Known Subclasses:
JifInstType_c.PlaceHolder, LabeledType_c, NullType_c, PlaceHolder_c, PrimitiveType_c, ReferenceType_c, UnknownType_c

public abstract class Type_c
extends TypeObject_c
implements Type

Abstract implementation of a Type. This implements most of the "isa" and "cast" methods of the type and methods which just dispatch to the type system.

See Also:
Serialized Form

Fields inherited from class jltools.ext.jl.types.TypeObject_c
position, ts
 
Constructor Summary
protected Type_c()
          Used for deserializing types.
  Type_c(TypeSystem ts)
          Creates a new type in the given a TypeSystem.
  Type_c(TypeSystem ts, Position pos)
           
 
Method Summary
 ArrayType arrayOf()
           
 ArrayType arrayOf(int dims)
           
 boolean descendsFrom(Type ancestor)
           
 boolean isArray()
           
 boolean isAssignableSubtype(Type ancestor)
           
 boolean isBoolean()
           
 boolean isByte()
           
 boolean isCanonical()
           
 boolean isCastValid(Type toType)
           
 boolean isChar()
           
 boolean isClass()
           
 boolean isComparable(Type t)
           
 boolean isDouble()
           
 boolean isFloat()
           
 boolean isImplicitCastValid(Type toType)
           
 boolean isInt()
           
 boolean isIntOrLess()
           
 boolean isLong()
           
 boolean isLongOrLess()
           
 boolean isNull()
           
 boolean isNumeric()
           
 boolean isPackage()
           
 boolean isPrimitive()
           
 boolean isReference()
           
 boolean isSame(Type t)
           
 boolean isShort()
           
 boolean isSubtype(Type t)
           
 boolean isThrowable()
           
 boolean isType()
           
 boolean isUncheckedException()
           
 boolean isVoid()
           
 ArrayType toArray()
          Returns a non-null iff isArray() returns true.
 ClassType toClass()
          Returns a non-null iff isClass() returns true.
 NullType toNull()
          Returns a non-null iff isNull() returns true.
 Package toPackage()
           
 PrimitiveType toPrimitive()
          Returns a non-null iff isPrimitive() returns true.
 ReferenceType toReference()
          Returns a non-null iff isReference() returns true.
abstract  java.lang.String toString()
           
 Type toType()
           
abstract  java.lang.String translate(Context c)
           
 
Methods inherited from class jltools.ext.jl.types.TypeObject_c
copy, position, restore_, restore, typeSystem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jltools.types.TypeObject
position, restore, typeSystem
 
Methods inherited from interface jltools.util.Copy
copy
 

Constructor Detail

Type_c

protected Type_c()
Used for deserializing types.

Type_c

public Type_c(TypeSystem ts)
Creates a new type in the given a TypeSystem.

Type_c

public Type_c(TypeSystem ts,
              Position pos)
Method Detail

translate

public abstract java.lang.String translate(Context c)
Specified by:
translate in interface Type

isType

public boolean isType()
Specified by:
isType in interface Qualifier

isPackage

public boolean isPackage()
Specified by:
isPackage in interface Qualifier

toType

public Type toType()
Specified by:
toType in interface Qualifier

toPackage

public Package toPackage()
Specified by:
toPackage in interface Qualifier

isCanonical

public boolean isCanonical()
Specified by:
isCanonical in interface TypeObject

isPrimitive

public boolean isPrimitive()
Specified by:
isPrimitive in interface Type

isNumeric

public boolean isNumeric()
Specified by:
isNumeric in interface Type

isIntOrLess

public boolean isIntOrLess()
Specified by:
isIntOrLess in interface Type

isLongOrLess

public boolean isLongOrLess()
Specified by:
isLongOrLess in interface Type

isVoid

public boolean isVoid()
Specified by:
isVoid in interface Type

isBoolean

public boolean isBoolean()
Specified by:
isBoolean in interface Type

isChar

public boolean isChar()
Specified by:
isChar in interface Type

isByte

public boolean isByte()
Specified by:
isByte in interface Type

isShort

public boolean isShort()
Specified by:
isShort in interface Type

isInt

public boolean isInt()
Specified by:
isInt in interface Type

isLong

public boolean isLong()
Specified by:
isLong in interface Type

isFloat

public boolean isFloat()
Specified by:
isFloat in interface Type

isDouble

public boolean isDouble()
Specified by:
isDouble in interface Type

isReference

public boolean isReference()
Specified by:
isReference in interface Type

isNull

public boolean isNull()
Specified by:
isNull in interface Type

isClass

public boolean isClass()
Specified by:
isClass in interface Type

isArray

public boolean isArray()
Specified by:
isArray in interface Type

isThrowable

public final boolean isThrowable()
Specified by:
isThrowable in interface Type

isUncheckedException

public final boolean isUncheckedException()
Specified by:
isUncheckedException in interface Type

toClass

public ClassType toClass()
Returns a non-null iff isClass() returns true.
Specified by:
toClass in interface Type

toNull

public NullType toNull()
Returns a non-null iff isNull() returns true.
Specified by:
toNull in interface Type

toReference

public ReferenceType toReference()
Returns a non-null iff isReference() returns true.
Specified by:
toReference in interface Type

toPrimitive

public PrimitiveType toPrimitive()
Returns a non-null iff isPrimitive() returns true.
Specified by:
toPrimitive in interface Type

toArray

public ArrayType toArray()
Returns a non-null iff isArray() returns true.
Specified by:
toArray in interface Type

arrayOf

public ArrayType arrayOf(int dims)
Specified by:
arrayOf in interface Type

arrayOf

public ArrayType arrayOf()
Specified by:
arrayOf in interface Type

isSubtype

public final boolean isSubtype(Type t)
Specified by:
isSubtype in interface Type

isSame

public final boolean isSame(Type t)
Specified by:
isSame in interface Type

descendsFrom

public final boolean descendsFrom(Type ancestor)
Specified by:
descendsFrom in interface Type

isAssignableSubtype

public final boolean isAssignableSubtype(Type ancestor)
Specified by:
isAssignableSubtype in interface Type

isCastValid

public final boolean isCastValid(Type toType)
Specified by:
isCastValid in interface Type

isImplicitCastValid

public final boolean isImplicitCastValid(Type toType)
Specified by:
isImplicitCastValid in interface Type

isComparable

public final boolean isComparable(Type t)

toString

public abstract java.lang.String toString()
Overrides:
toString in class java.lang.Object