public class InsnList
extends java.lang.Object
AbstractInsnNode
objects. This implementation is not thread
safe.Constructor and Description |
---|
InsnList() |
Modifier and Type | Method and Description |
---|---|
void |
accept(org.objectweb.asm.MethodVisitor methodVisitor)
Makes the given visitor visit all the instructions in this list.
|
void |
add(AbstractInsnNode insnNode)
Adds the given instruction to the end of this list.
|
void |
add(InsnList insnList)
Adds the given instructions to the end of this list.
|
void |
clear()
Removes all the instructions of this list.
|
boolean |
contains(AbstractInsnNode insnNode)
Returns true if the given instruction belongs to this list.
|
AbstractInsnNode |
get(int index)
Returns the instruction whose index is given.
|
AbstractInsnNode |
getFirst()
Returns the first instruction in this list.
|
AbstractInsnNode |
getLast()
Returns the last instruction in this list.
|
int |
indexOf(AbstractInsnNode insnNode)
Returns the index of the given instruction in this list.
|
void |
insert(AbstractInsnNode insnNode)
Inserts the given instruction at the beginning of this list.
|
void |
insert(AbstractInsnNode previousInsn,
AbstractInsnNode insnNode)
Inserts the given instruction after the specified instruction.
|
void |
insert(AbstractInsnNode previousInsn,
InsnList insnList)
Inserts the given instructions after the specified instruction.
|
void |
insert(InsnList insnList)
Inserts the given instructions at the beginning of this list.
|
void |
insertBefore(AbstractInsnNode nextInsn,
AbstractInsnNode insnNode)
Inserts the given instruction before the specified instruction.
|
void |
insertBefore(AbstractInsnNode nextInsn,
InsnList insnList)
Inserts the given instructions before the specified instruction.
|
java.util.ListIterator<AbstractInsnNode> |
iterator()
Returns an iterator over the instructions in this list.
|
java.util.ListIterator<AbstractInsnNode> |
iterator(int index)
Returns an iterator over the instructions in this list.
|
void |
remove(AbstractInsnNode insnNode)
Removes the given instruction from this list.
|
void |
resetLabels()
Resets all the labels in the instruction list.
|
void |
set(AbstractInsnNode oldInsnNode,
AbstractInsnNode newInsnNode)
Replaces an instruction of this list with another instruction.
|
int |
size()
Returns the number of instructions in this list.
|
AbstractInsnNode[] |
toArray()
Returns an array containing all the instructions in this list.
|
public int size()
public AbstractInsnNode getFirst()
public AbstractInsnNode getLast()
public AbstractInsnNode get(int index)
index
- the index of the instruction that must be returned.java.lang.IndexOutOfBoundsException
- if (index < 0 || index >= size()).public boolean contains(AbstractInsnNode insnNode)
insnNode
- an instruction.public int indexOf(AbstractInsnNode insnNode)
insnNode
- an instruction of this list.contains(org.objectweb.asm.tree.AbstractInsnNode)
to test if an instruction belongs to an instruction list or not.public void accept(org.objectweb.asm.MethodVisitor methodVisitor)
methodVisitor
- the method visitor that must visit the instructions.public java.util.ListIterator<AbstractInsnNode> iterator()
public java.util.ListIterator<AbstractInsnNode> iterator(int index)
index
- index of instruction for the iterator to start at.public AbstractInsnNode[] toArray()
public void set(AbstractInsnNode oldInsnNode, AbstractInsnNode newInsnNode)
oldInsnNode
- an instruction of this list.newInsnNode
- another instruction, which must not belong to any InsnList
.public void add(AbstractInsnNode insnNode)
insnNode
- an instruction, which must not belong to any InsnList
.public void add(InsnList insnList)
insnList
- an instruction list, which is cleared during the process. This list must be
different from 'this'.public void insert(AbstractInsnNode insnNode)
insnNode
- an instruction, which must not belong to any InsnList
.public void insert(InsnList insnList)
insnList
- an instruction list, which is cleared during the process. This list must be
different from 'this'.public void insert(AbstractInsnNode previousInsn, AbstractInsnNode insnNode)
previousInsn
- an instruction of this list after which insnNode must be inserted.insnNode
- the instruction to be inserted, which must not belong to any InsnList
.public void insert(AbstractInsnNode previousInsn, InsnList insnList)
previousInsn
- an instruction of this list after which the instructions must be
inserted.insnList
- the instruction list to be inserted, which is cleared during the process. This
list must be different from 'this'.public void insertBefore(AbstractInsnNode nextInsn, AbstractInsnNode insnNode)
nextInsn
- an instruction of this list before which insnNode must be inserted.insnNode
- the instruction to be inserted, which must not belong to any InsnList
.public void insertBefore(AbstractInsnNode nextInsn, InsnList insnList)
nextInsn
- an instruction of this list before which the instructions must be
inserted.insnList
- the instruction list to be inserted, which is cleared during the process. This
list must be different from 'this'.public void remove(AbstractInsnNode insnNode)
insnNode
- the instruction of this list that must be removed.public void clear()
public void resetLabels()
ClassWriter
s.