edu.rice.cs.cunit.classFile.attributes
Class AAttributeInfo

java.lang.Object
  extended by edu.rice.cs.cunit.classFile.attributes.AAttributeInfo
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
AAnnotationsAttributeInfo, AnnotationDefaultAttributeInfo, CodeAttributeInfo, ConstantValueAttributeInfo, DeprecatedAttributeInfo, EnclosingMethodAttributeInfo, ExceptionsAttributeInfo, InnerClassesAttributeInfo, InstrumentationAttributeInfo, LineNumberTableAttributeInfo, LocalVariableTableAttributeInfo, LocalVariableTypeTableAttributeInfo, SignatureAttributeInfo, SourceFileAttributeInfo, SyntheticAttributeInfo, UnknownAttributeInfo

public abstract class AAttributeInfo
extends java.lang.Object
implements java.lang.Cloneable

Author:
Mathias Ricken

Field Summary
protected  ConstantPool _constantPool
          Constant pool.
protected  byte[] _data
          Attribute _data.
private static java.lang.Class<AAttributeInfo>[] _knownAttributes
          Array with registered attributes.
protected  AUTFPoolInfo _name
          Attribute _name information.
 
Constructor Summary
AAttributeInfo(AUTFPoolInfo name, byte[] data, ConstantPool cp)
          Constructor.
 
Method Summary
abstract  void adjustPC(int startPC, int deltaPC)
          Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them.
 java.lang.Object clone()
          Creates and returns a copy of this object.
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
abstract
<R,D> R
execute(IAttributeVisitor<R,D> visitor, D param)
          Execute a visitor on this attribute.
 byte[] getData()
          Accessor for data.
 AUTFPoolInfo getName()
          Accessor for _name information.
 int hashCode()
           
static AAttributeInfo read(java.io.DataInputStream di, ConstantPool pool)
          Read from stream and return unresolved constant pool object.
 void setData(byte[] data)
          Mutator for data.
 void setName(AUTFPoolInfo name)
          Mutator for _name information.
 java.lang.String toString()
          Return a human-readable version of this attribute.
abstract  void translatePC(int index, int deltaIndex, LineNumberTable oldLnt, LineNumberTable newLnt)
          Translate the program counter values contained in this attribute from an old line number table to a new one.
 void write(java.io.DataOutputStream dos)
          Write this attribute into a stream
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

protected AUTFPoolInfo _name
Attribute _name information.


_data

protected byte[] _data
Attribute _data.


_constantPool

protected ConstantPool _constantPool
Constant pool.


_knownAttributes

private static java.lang.Class<AAttributeInfo>[] _knownAttributes
Array with registered attributes.

Constructor Detail

AAttributeInfo

public AAttributeInfo(AUTFPoolInfo name,
                      byte[] data,
                      ConstantPool cp)
Constructor.

Parameters:
name - attrobite name
data - attribute data
cp -
Method Detail

read

public static AAttributeInfo read(java.io.DataInputStream di,
                                  ConstantPool pool)
                           throws java.io.IOException,
                                  java.lang.ClassFormatError
Read from stream and return unresolved constant pool object.

Parameters:
di - stream
pool - constant pool
Returns:
attribute
Throws:
java.io.IOException
java.lang.ClassFormatError

getName

public AUTFPoolInfo getName()
Accessor for _name information.

Returns:
_name information

setName

public void setName(AUTFPoolInfo name)
Mutator for _name information.

Parameters:
name - _name information

getData

public byte[] getData()
Accessor for data.

Returns:
data data

setData

public void setData(byte[] data)
Mutator for data.

Parameters:
data - data

write

public void write(java.io.DataOutputStream dos)
           throws java.io.IOException
Write this attribute into a stream

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

toString

public java.lang.String toString()
Return a human-readable version of this attribute.

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

execute

public abstract <R,D> R execute(IAttributeVisitor<R,D> visitor,
                                D param)
Execute a visitor on this attribute.

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

adjustPC

public abstract void adjustPC(int startPC,
                              int deltaPC)
Adjust program counter values contained in this attribute, starting at startPC, by adding deltaPC to them.

Parameters:
startPC - program counter to start at
deltaPC - change in program counter values

translatePC

public abstract void translatePC(int index,
                                 int deltaIndex,
                                 LineNumberTable oldLnt,
                                 LineNumberTable newLnt)
Translate the program counter values contained in this attribute from an old line number table to a new one.

Parameters:
index - critical point (insertion or deletion point)
deltaIndex - delta value to add to all old line numbers greater than the critical point
oldLnt - old line number table
newLnt - new line number table

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object