final class ConstantCollection extends java.lang.Object implements IConstantCollection
| Modifier and Type | Class and Description |
|---|---|
private static class |
ConstantCollection.ConstantIterator |
IConstantCollection.IConstantComparator, IConstantCollection.IConstantIterator| Modifier and Type | Field and Description |
|---|---|
private ObjectIntMap |
m_CONSTANT_Utf8_index |
private java.util.List |
m_constants |
private int |
m_size |
| Constructor and Description |
|---|
ConstantCollection(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(IClassDefVisitor visitor,
java.lang.Object ctx) |
int |
add(CONSTANT_info constant)
Appends 'constant' to the end of the collection.
|
java.lang.Object |
clone()
Performs a deep copy.
|
int |
find(int type,
IConstantCollection.IConstantComparator comparator)
Searches the pool for a matching constant of given type with equality
semantics expressed by 'comparator'.
|
int |
findCONSTANT_Utf8(java.lang.String value)
Convenience method that can lookup CONSTANT_Utf8 entries in O(1) time
on average.
|
CONSTANT_info |
get(int index)
Returns a CONSTANT_info at a given pool index.
|
private ObjectIntMap |
getCONSTANT_Utf8_index() |
IConstantCollection.IConstantIterator |
iterator()
Returns a fail-fast iterator over all valid entries in the pool.
|
CONSTANT_info |
set(int index,
CONSTANT_info constant)
Replaces an existing constant pool entry.
|
int |
size()
Returns the number of CONSTANT_info entries in this collection.
|
void |
writeInClassFormat(UDataOutputStream out) |
private java.util.List m_constants
private int m_size
private transient ObjectIntMap m_CONSTANT_Utf8_index
public CONSTANT_info get(int index)
IConstantCollectionIConstantCollection.iterator() to iterate only over valid entries
in a transparent fashion.get in interface IConstantCollectionindex - constant pool index [must be in [1, size()] range]public IConstantCollection.IConstantIterator iterator()
IConstantCollectioniterator in interface IConstantCollectionpublic int find(int type,
IConstantCollection.IConstantComparator comparator)
IConstantCollectionfind in interface IConstantCollectiontype - type of constants to filter by [not validated]comparator - [may not be null]public int findCONSTANT_Utf8(java.lang.String value)
IConstantCollectionfindCONSTANT_Utf8 in interface IConstantCollectionvalue - string value on which to match [may not be null]public int size()
IConstantCollectionsize in interface IConstantCollectionpublic java.lang.Object clone()
clone in interface IConstantCollectionclone in class java.lang.Objectpublic void writeInClassFormat(UDataOutputStream out) throws java.io.IOException
writeInClassFormat in interface IClassFormatOutputjava.io.IOExceptionpublic void accept(IClassDefVisitor visitor, java.lang.Object ctx)
accept in interface IConstantCollectionpublic CONSTANT_info set(int index, CONSTANT_info constant)
IConstantCollectionset in interface IConstantCollectionindex - constant pool index [must be in [1, size()] range]constant - new entry to set [may not be null; input unchecked]public int add(CONSTANT_info constant)
IConstantCollectionadd in interface IConstantCollectionconstant - new constant [may not be null; input unchecked]private ObjectIntMap getCONSTANT_Utf8_index()