edu.rice.cs.cunit.classFile.constantPool
Class APoolInfo

java.lang.Object
  extended by edu.rice.cs.cunit.classFile.constantPool.APoolInfo
Direct Known Subclasses:
AClassNameTypePoolInfo, AUTFPoolInfo, ClassPoolInfo, DoublePoolInfo, EmptyPoolInfo, FloatPoolInfo, IntegerPoolInfo, LongPoolInfo, NameAndTypePoolInfo, StringPoolInfo

public abstract class APoolInfo
extends java.lang.Object

Represents an abstract constant pool object.

Author:
Mathias Ricken

Field Summary
protected  ConstantPool _constantPool
          Reference to the constant pool.
protected  int _type
          Object type.
static int CONSTANT_Class
           
static int CONSTANT_Double
           
static int CONSTANT_Fieldref
           
static int CONSTANT_Float
           
static int CONSTANT_Integer
           
static int CONSTANT_InterfaceMethodref
           
static int CONSTANT_Long
           
static int CONSTANT_Methodref
           
static int CONSTANT_NameAndType
           
static int CONSTANT_String
           
static int CONSTANT_Utf8_ASCII
           
static int CONSTANT_Utf8_Unicode
           
 
Constructor Summary
APoolInfo(int type, ConstantPool cp)
          Constructor
 
Method Summary
abstract  boolean equals(java.lang.Object obj)
          Compare this object and another one.
abstract
<R,D> R
execute(IPoolInfoVisitor<R,D> visitor, D data)
          Execute a visitor.
abstract  int hashCode()
          Return a hash code.
 APoolInfo inPool(ConstantPool pool)
          Return the reference to the constant pool item that is already in pool, that matches this one.
static APoolInfo read(PositionDataInputStream dis, ConstantPool cp)
          Read from stream and return unresolved constant pool object.
abstract  void reindex()
          Reindex constant pool indices.
abstract  void resolve()
          Resolve constant pool objects.
abstract  java.lang.String toString()
          Return a human-readable version of this constant pool object.
abstract  java.lang.String toStringVerbose()
          Return a human-readable version of this constant pool object.
abstract  void write(java.io.DataOutputStream dos)
          Write this constant pool object into the stream, including the type byte.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CONSTANT_Class

public static final int CONSTANT_Class
See Also:
Constant Field Values

CONSTANT_Fieldref

public static final int CONSTANT_Fieldref
See Also:
Constant Field Values

CONSTANT_Methodref

public static final int CONSTANT_Methodref
See Also:
Constant Field Values

CONSTANT_InterfaceMethodref

public static final int CONSTANT_InterfaceMethodref
See Also:
Constant Field Values

CONSTANT_String

public static final int CONSTANT_String
See Also:
Constant Field Values

CONSTANT_Integer

public static final int CONSTANT_Integer
See Also:
Constant Field Values

CONSTANT_Float

public static final int CONSTANT_Float
See Also:
Constant Field Values

CONSTANT_Long

public static final int CONSTANT_Long
See Also:
Constant Field Values

CONSTANT_Double

public static final int CONSTANT_Double
See Also:
Constant Field Values

CONSTANT_NameAndType

public static final int CONSTANT_NameAndType
See Also:
Constant Field Values

CONSTANT_Utf8_ASCII

public static final int CONSTANT_Utf8_ASCII
See Also:
Constant Field Values

CONSTANT_Utf8_Unicode

public static final int CONSTANT_Utf8_Unicode
See Also:
Constant Field Values

_type

protected int _type
Object type.


_constantPool

protected ConstantPool _constantPool
Reference to the constant pool.

Constructor Detail

APoolInfo

public APoolInfo(int type,
                 ConstantPool cp)
Constructor

Parameters:
type - object type
Method Detail

read

public static APoolInfo read(PositionDataInputStream dis,
                             ConstantPool cp)
                      throws java.io.IOException,
                             java.lang.ClassFormatError
Read from stream and return unresolved constant pool object.

Parameters:
dis - stream
Returns:
unresolved constant pool object.
Throws:
java.io.IOException
java.lang.ClassFormatError

inPool

public APoolInfo inPool(ConstantPool pool)
Return the reference to the constant pool item that is already in pool, that matches this one.

Parameters:
pool - constant pool
Returns:
matching object or null if not found

write

public abstract void write(java.io.DataOutputStream dos)
                    throws java.io.IOException
Write this constant pool object into the stream, including the type byte.

Parameters:
dos - stream
Throws:
java.io.IOException

resolve

public abstract void resolve()
Resolve constant pool objects. This makes sure that the object links match the index links.


reindex

public abstract void reindex()
Reindex constant pool indices. This makes sure the index links match the object links.


toStringVerbose

public abstract java.lang.String toStringVerbose()
Return a human-readable version of this constant pool object.

Returns:
string

toString

public abstract java.lang.String toString()
Return a human-readable version of this constant pool object.

Overrides:
toString in class java.lang.Object
Returns:
string

hashCode

public abstract int hashCode()
Return a hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code

equals

public abstract boolean equals(java.lang.Object obj)
Compare this object and another one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - other object
Returns:
true if the same

execute

public abstract <R,D> R execute(IPoolInfoVisitor<R,D> visitor,
                                D data)
Execute a visitor.

Parameters:
visitor - visitor
data - visitor-specific parameter
Returns:
visitor-specific return value