|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An abstraction of constant pool in .class format. This interface disallows any pool mutation that invalidates already existing pool indices.
Nested Class Summary | |
static interface |
IConstantCollection.IConstantComparator
A simple interface to express custom semantics of constant equality. |
static interface |
IConstantCollection.IConstantIterator
A custom fail-fast iterator class returned by iterator() . |
Method Summary | |
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()
|
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. |
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. |
Methods inherited from interface com.vladium.jcd.compiler.IClassFormatOutput |
writeInClassFormat |
Method Detail |
public CONSTANT_info get(int index)
iterator()
to iterate only over valid entries
in a transparent fashion.
index
- constant pool index [must be in [1, size()] range]
java.lang.IllegalStateException
- if an attempt is made to reference
an invalid slot index
java.lang.IndexOutOfBoundsException
- if an attempt is made to reference
a slot outside of the valid rangepublic IConstantCollection.IConstantIterator iterator()
public int find(int type, IConstantCollection.IConstantComparator comparator)
type
- type of constants to filter by [not validated]comparator
- [may not be null]
java.lang.IllegalArgumentException
- if 'comparator' is nullpublic int findCONSTANT_Utf8(java.lang.String value)
value
- string value on which to match [may not be null]
java.lang.IllegalArgumentException
- if 'value' is nullpublic int size()
public java.lang.Object clone()
public void accept(IClassDefVisitor visitor, java.lang.Object ctx)
public int add(CONSTANT_info constant)
constant
- new constant [may not be null; input unchecked]
public CONSTANT_info set(int index, CONSTANT_info constant)
index
- constant pool index [must be in [1, size()] range]constant
- new entry to set [may not be null; input unchecked]
java.lang.IllegalArgumentException
- if the new constant's width is different
from the current entry's
java.lang.IllegalStateException
- if an attempt is made to reference
an invalid slot index [see get(int)
]
java.lang.IndexOutOfBoundsException
- if an attempt is made to reference
a slot outside of the valid range
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |