Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.type
Class RangeType

java.lang.Object
  extended bynet.sf.jode.type.Type
      extended bynet.sf.jode.type.RangeType

public class RangeType
extends Type

This class represents a set of reference types. The set contains all types that are castable to all the bottom types by a widening cast and to which one of the top types can be casted to by a widening cast.
For a totally unknown reference type bottomType is tObject and topType is tNull. The bottomType is always guaranteed to be not tNull. And all topTypes must be castable to all bottom types with a widening cast.
To do intersection on range types, the reference types need three more operations: specialization, generalization and createRange.

specialization chooses all common sub type of two types. It is used to find the bottom of the intersected interval.

generalization chooses the common super type of two types. It is used to find the top of the intersected interval.

When the new interval is created with createRangeType the bottom and top are adjusted so that they only consists of possible types. It then decides, if it needs a range type, or if the reference types already represents all types.

Author:
Jochen Hoenicke
See Also:
ReferenceType

Field Summary
 
Fields inherited from class net.sf.jode.type.Type
EMPTY_IFACES, tBoolByte, tBoolean, tBoolInt, tBoolUInt, tByte, TC_ARRAY, TC_BOOLEAN, TC_BYTE, TC_CHAR, TC_CLASS, TC_CLASSIFACE, TC_DOUBLE, TC_ERROR, TC_FLOAT, TC_INT, TC_INTEGER, TC_LONG, TC_METHOD, TC_NULL, TC_RANGE, TC_SHORT, TC_SYSCLASS, TC_UNKNOWN, TC_VOID, tChar, tCloneable, tComparable, tDouble, tError, tFloat, tInt, tJavaLangClass, tLong, tNull, tObject, tSerializable, tShort, tString, tStringBuffer, tStringBuilder, tUInt, tUnknown, tUObject, tVoid
 
Constructor Summary
RangeType(ReferenceType bottomType, ReferenceType topType)
          Create a new range type with the given bottom and top set.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 ReferenceType getBottom()
          Returns the bottom type set.
 Type getCanonic()
          Returns the canonic type of this range type set.
 Type getCastHelper(Type fromType)
          Checks if we need to cast to a middle type, before we can cast from fromType to this type.
 java.lang.String getDefaultName()
          Generates the default name, that is the `natural' choice for local of this type.
 Type getHint()
          Returns the hint type of this range type set.
 Type getSubType()
          The set of sub types of this type.
 Type getSuperType()
          The set of super types of this type.
 ReferenceType getTop()
          Returns the top type set.
 java.lang.Class getTypeClass()
          Returns the java.lang.Class representing this type.
 java.lang.String getTypeSignature()
          Returns the type signature of this type.
 int hashCode()
           
 Type intersection(Type type)
          Intersect this type with another type and return the new type.
 java.lang.String toString()
          Returns a string representation describing this type set.
 
Methods inherited from class net.sf.jode.type.Type
getDefaultValue, getTypeCode, isClassType, isOfType, isSubTypeOf, isValidType, maybeSubTypeOf, stackSize, tArray, tClass, tClass, tMethod, tRange, tSubType, tSuperType, tSystemClass, tType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangeType

public RangeType(ReferenceType bottomType,
                 ReferenceType topType)
Create a new range type with the given bottom and top set.

Method Detail

getBottom

public ReferenceType getBottom()
Returns the bottom type set. All types in this range type can be casted to all bottom types by a widening cast.

Returns:
the bottom type set

getTop

public ReferenceType getTop()
Returns the top type set. For each type in this range type, there is a top type, that can be casted to this type.

Returns:
the top type set

getHint

public Type getHint()
Returns the hint type of this range type set. This returns the singleton set containing only the first top type, except if it is null and there is a unique bottom type, in which case it returns the bottom type.

Overrides:
getHint in class Type
Returns:
the hint type.

getCanonic

public Type getCanonic()
Returns the canonic type of this range type set. This returns the singleton set containing only the first top type.

Overrides:
getCanonic in class Type
Returns:
the canonic type.

getSuperType

public Type getSuperType()
The set of super types of this type. This is the set of super types of the top type.

Overrides:
getSuperType in class Type
Returns:
the set of super types.

getSubType

public Type getSubType()
The set of sub types of this type. This is the set of sub types of the bottom types.

Overrides:
getSubType in class Type
Returns:
the set of super types.

getCastHelper

public Type getCastHelper(Type fromType)
Checks if we need to cast to a middle type, before we can cast from fromType to this type.

Overrides:
getCastHelper in class Type
Returns:
the middle type, or null if it is not necessary.

getTypeSignature

public java.lang.String getTypeSignature()
Description copied from class: Type
Returns the type signature of this type. You should only call this on singleton types.

Overrides:
getTypeSignature in class Type
Returns:
the type (or method) signature of this type.

getTypeClass

public java.lang.Class getTypeClass()
                             throws java.lang.ClassNotFoundException
Description copied from class: Type
Returns the java.lang.Class representing this type. You should only call this on singleton types.

Overrides:
getTypeClass in class Type
Returns:
the Class object representing this type.
Throws:
java.lang.ClassNotFoundException

toString

public java.lang.String toString()
Description copied from class: Type
Returns a string representation describing this type set.

Overrides:
toString in class Type
Returns:
a string representation describing this type set.

getDefaultName

public java.lang.String getDefaultName()
Description copied from class: Type
Generates the default name, that is the `natural' choice for local of this type.

Overrides:
getDefaultName in class Type
Returns:
the default name of a local of this type.

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object o)

intersection

public Type intersection(Type type)
Intersect this type with another type and return the new type.

Overrides:
intersection in class Type
Parameters:
type - the other type.
Returns:
the intersection, or tError, if a type conflict happens.

Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.