harpoon.Backend.RuntimeTiny
Class PreOrderClazNumbering

java.lang.Object
  extended by harpoon.Backend.RuntimeTiny.PreOrderClazNumbering

public class PreOrderClazNumbering
extends Object

PreOrderClazNumbering will number single-inheritance instantiated classes (i.e. not interfaces or arrays of interfaces) such that all classes numbered in an interval [a,b] will be instances of the first common superclass of A and B, where clazNumber(A)==a and clazNumber(B)==b. This is useful for implementing quick 'instanceOf' tests; to determine if an object is an instanceof class A, you can simply see if the object falls within the interval [classNumber(A),maxChildNumber(A)].

Version:
$Id: PreOrderClazNumbering.java,v 1.2 2002/04/10 03:03:43 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
PreOrderClazNumbering(ClassHierarchy ch)
          Creates a PreOrderClazNumbering.
 
Method Summary
 int clazNumber(HClass hc)
          Returns the number associated with the given HClass.
 int maxChildNumber(HClass hc)
          Returns the maximum number associated with an instantiatable child of the given HClass.
 int maxNumber()
          Returns the largest number which this ClazNumbering will associate with any HClass.
 int minNumber()
          Returns the smallest number which this ClazNumbering will associate with any HClass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreOrderClazNumbering

public PreOrderClazNumbering(ClassHierarchy ch)
Creates a PreOrderClazNumbering.

Method Detail

clazNumber

public int clazNumber(HClass hc)
Returns the number associated with the given HClass.


maxChildNumber

public int maxChildNumber(HClass hc)
Returns the maximum number associated with an instantiatable child of the given HClass.


minNumber

public int minNumber()
Returns the smallest number which this ClazNumbering will associate with any HClass.


maxNumber

public int maxNumber()
Returns the largest number which this ClazNumbering will associate with any HClass.