jbet
Class Descriptor

java.lang.Object
  extended by jbet.Descriptor

public final class Descriptor
extends java.lang.Object

An instance of this class describes the number and type of the parameters of the method described by the instance, and the method's return type. This file contains fields that hold the types of the parameters and the return type (if any) of the method that is described by an instance of this class. This file also includes code that: 1) initializes the fields 2) TBD $Id: Descriptor.java,v 1.9 2003/09/09 17:31:53 areisse Exp $

Since:
JDK 1.1.8

Field Summary
 Type[] args
           
 Type ret
           
static Descriptor returnInt
           
static Descriptor Void
           
 
Constructor Summary
Descriptor()
           
Descriptor(Descriptor d)
          Construct a new Descriptor based on a template
Descriptor(java.lang.String str)
          A constructor for Descriptor (describing a method M).
Descriptor(Type r)
           
Descriptor(Type p1, Type r)
           
 
Method Summary
 int count()
          for invokeinterface
 java.lang.String declaration()
           
 boolean equals(java.lang.Object o)
          Test if the descriptor argument has the same (argument / return) types as the (calling) descriptor.
 int hashCode()
          Implements hashCode for Descriptor by calculating a hash of the return type and the parameters of the method in that order.
 Descriptor relocate_new(java.util.Hashtable subs)
          Relocate a copy of the current descriptor (the current descriptor is unchanged).
 void relocate(java.util.Hashtable subs)
          Relocate all of the type references used by this descriptor
 java.lang.String toString()
          Convert the internal representation of the types associated with the method to a string stored in Descriptor.stringCache
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

args

public Type[] args

ret

public Type ret

Void

public static final Descriptor Void

returnInt

public static final Descriptor returnInt
Constructor Detail

Descriptor

public Descriptor(Type p1,
                  Type r)

Descriptor

public Descriptor(Type r)

Descriptor

public Descriptor()

Descriptor

public Descriptor(Descriptor d)
Construct a new Descriptor based on a template

Parameters:
d - the template method Descriptor.
See Also:
and Snippit.relocate

Descriptor

public Descriptor(java.lang.String str)
           throws ParseException
A constructor for Descriptor (describing a method M).

Parameters:
str - the params of M in "(typeof param0, typeof param1, ...) ret type" format
Throws:
ParseException
Method Detail

relocate

public void relocate(java.util.Hashtable subs)
Relocate all of the type references used by this descriptor

Parameters:
subs - A table of string substitution pairs.
See Also:
ClassRep.relocate

relocate_new

public Descriptor relocate_new(java.util.Hashtable subs)
Relocate a copy of the current descriptor (the current descriptor is unchanged).

Parameters:
subs - a table of string substitution pairs.
Returns:
the new (relocated) Descriptor.
See Also:
and Snippit.relocate

count

public int count()
for invokeinterface

Returns:
the number of words needed to store the method's parameters

toString

public java.lang.String toString()
Convert the internal representation of the types associated with the method to a string stored in Descriptor.stringCache

Overrides:
toString in class java.lang.Object
Returns:
a string depicting the types of the (refering) method

equals

public boolean equals(java.lang.Object o)
Test if the descriptor argument has the same (argument / return) types as the (calling) descriptor.

Overrides:
equals in class java.lang.Object
Parameters:
o - a method descriptor (return false otherwise)
Returns:
true two descriptors have the same (argument / return) types, false otherwise

hashCode

public int hashCode()
Implements hashCode for Descriptor by calculating a hash of the return type and the parameters of the method in that order.

Overrides:
hashCode in class java.lang.Object
Returns:
the value hash(ret) * 101^(n+1) + hash(param0) * 101^(n) + ... + hash(paramn)

declaration

public java.lang.String declaration()