harpoon.Analysis.MetaMethods
Class GenType

java.lang.Object
  extended by harpoon.Analysis.MetaMethods.GenType
All Implemented Interfaces:
Serializable

public class GenType
extends Object
implements Serializable

GenType models a type. Although we can always record the possible types of a variable as a set of HClasses, this is inneficient in most of the cases. GenType tries to cope with this by representing both monomorphic types (which correspond to a single HCode) and polymorphic types (which correspond to a set of HClasses, a type cone rooted in a specific HClass)

Version:
$Id: GenType.java,v 1.5 2002/05/02 22:11:39 salcianu Exp $
Author:
Alexandru SALCIANU <salcianu@retezat.lcs.mit.edu>
See Also:
Serialized Form

Field Summary
static int MONO
          Monomorphic type.
static int POLY
          Polymorphic type.
 
Constructor Summary
GenType(HClass hclass)
          Creates a polymorphic type, having hclass as superclass.
GenType(HClass hclass, int kind)
          Creates a GenType.
 
Method Summary
 boolean equals(Object o)
          Checks the equality of this object with object o.
 HClass getHClass()
          Returns the underlying HClass.
 int hashCode()
          Computes the hash code of this object.
 boolean included(GenType gt2, ClassHierarchy ch)
          Checks whether this general type is included into the set of types abstracted by the general type gt2.
 boolean isPOLY()
          Checks whether this is a polymorphic type.
 String toString()
          Pretty printer for debug purposes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MONO

public static final int MONO
Monomorphic type. This is an exact type, just the point hclass into the type space.

See Also:
Constant Field Values

POLY

public static final int POLY
Polymorphic type. This is a cone into the type space, rooted in hclass and containing hclass and all its subtypes (subclasses).

See Also:
Constant Field Values
Constructor Detail

GenType

public GenType(HClass hclass,
               int kind)
Creates a GenType. kind should be MONO or POLY.


GenType

public GenType(HClass hclass)
Creates a polymorphic type, having hclass as superclass.

Method Detail

isPOLY

public boolean isPOLY()
Checks whether this is a polymorphic type.


getHClass

public HClass getHClass()
Returns the underlying HClass. If this general type represents a monomorphic type, the result is exactly that type. Otherwise, for polymorphic types, the result is the root of the type cone.


equals

public boolean equals(Object o)
Checks the equality of this object with object o.

Overrides:
equals in class Object

hashCode

public int hashCode()
Computes the hash code of this object.

Overrides:
hashCode in class Object

included

public boolean included(GenType gt2,
                        ClassHierarchy ch)
Checks whether this general type is included into the set of types abstracted by the general type gt2.


toString

public String toString()
Pretty printer for debug purposes.

Overrides:
toString in class Object