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

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<APoolInfo>
              extended by edu.rice.cs.cunit.classFile.constantPool.ConstantPool
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<APoolInfo>, java.util.Collection<APoolInfo>, java.util.List<APoolInfo>, java.util.RandomAccess

public class ConstantPool
extends java.util.ArrayList<APoolInfo>

Constant pool.

Author:
Mathias Ricken
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ConstantPool()
          Constructs an empty constant pool with an initial capacity of ten.
ConstantPool(java.util.Collection<? extends APoolInfo> aPoolInfos)
          Constructs a constant pool containing the elements of the specified collection, in the order they are returned by the collection's iterator.
ConstantPool(int initialCapacity)
          Constructs an empty constant pool with the specified initial capacity.
 
Method Summary
 short indexOf(APoolInfo item)
          Return the index of the pool item in the pool.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

ConstantPool

public ConstantPool(int initialCapacity)
Constructs an empty constant pool with the specified initial capacity.

Parameters:
initialCapacity - the initial capacity of the constant pool.
Throws:
java.lang.IllegalArgumentException - if the specified initial capacity is negative

ConstantPool

public ConstantPool()
Constructs an empty constant pool with an initial capacity of ten.


ConstantPool

public ConstantPool(java.util.Collection<? extends APoolInfo> aPoolInfos)
Constructs a constant pool containing the elements of the specified collection, in the order they are returned by the collection's iterator. The ConstantPool instance has an initial capacity of 110% the size of the specified collection.

Parameters:
aPoolInfos - the collection whose elements are to be placed into this constant pool.
Throws:
java.lang.NullPointerException - if the specified collection is null.
Method Detail

indexOf

public short indexOf(APoolInfo item)
Return the index of the pool item in the pool.

Parameters:
item - item
Returns:
index