accept
public void accept(MethodVisitor mv)
Makes the given visitor visit all of the instructions in this list.
mv
- the method visitor that must visit the instructions.
add
public void add(AbstractInsnNode insn)
Adds the given instruction to the end of this list.
insn
- an instruction, which must not belong to any
InsnList
.
add
public void add(InsnList insns)
Adds the given instructions to the end of this list.
insns
- an instruction list, which is cleared during the process.
clear
public void clear()
Removes all of the instructions of this list.
contains
public boolean contains(AbstractInsnNode insn)
Returns true if the given instruction belongs to this list.
This method always scans the instructions of this list until it finds the
given instruction or reaches the end of the list.
- true if the given instruction belongs to this list.
get
public AbstractInsnNode get(int index)
Returns the instruction whose index is given. This method builds a cache
of the instructions in this list to avoid scanning the whole list each
time it is called. Once the cache is built, this method run in constant
time. This cache is invalidated by all the methods that modify the list.
index
- the index of the instruction that must be returned.
- the instruction whose index is given.
getFirst
public AbstractInsnNode getFirst()
Returns the first instruction in this list.
- the first instruction in this list, or null if the
list is empty.
getLast
public AbstractInsnNode getLast()
Returns the last instruction in this list.
- the last instruction in this list, or null if the list
is empty.
indexOf
public int indexOf(AbstractInsnNode insn)
Returns the index of the given instruction in this list. This method
builds a cache of the instruction indexes to avoid scanning the whole
list each time it is called. Once the cache is built, this method run in
constant time. The cache is invalidated by all the methods that modify
the list.
insn
- an instruction of this list.
- the index of the given instruction in this list. The result of
this method is undefined if the given instruction does not belong
to this list. Use
contains
to test if an
instruction belongs to an instruction list or not.
insert
public void insert(AbstractInsnNode insn)
Inserts the given instruction at the begining of this list.
insn
- an instruction, which must not belong to any
InsnList
.
insert
public void insert(AbstractInsnNode location,
AbstractInsnNode insn)
Inserts the given instruction after the specified instruction.
location
- an instruction of this list after which insn must be
inserted.insn
- the instruction to be inserted, which must not belong to
any InsnList
.
insert
public void insert(AbstractInsnNode location,
InsnList insns)
Inserts the given instructions after the specified instruction.
location
- an instruction of this list after which the instructions
must be inserted.insns
- the instruction list to be inserted, which is cleared during
the process.
insert
public void insert(InsnList insns)
Inserts the given instructions at the begining of this list.
insns
- an instruction list, which is cleared during the process.
insertBefore
public void insertBefore(AbstractInsnNode location,
AbstractInsnNode insn)
Inserts the given instruction before the specified instruction.
location
- an instruction of this list before which insn must be
inserted.insn
- the instruction to be inserted, which must not belong to
any InsnList
.
insertBefore
public void insertBefore(AbstractInsnNode location,
InsnList insns)
Inserts the given instructions before the specified instruction.
location
- an instruction of this list before which the instructions
must be inserted.insns
- the instruction list to be inserted, which is cleared during
the process.
iterator
public ListIterator iterator()
Returns an iterator over the instructions in this list.
- an iterator over the instructions in this list.
iterator
public ListIterator iterator(int index)
Returns an iterator over the instructions in this list.
- an iterator over the instructions in this list.
remove
public void remove(AbstractInsnNode insn)
Removes the given instruction from this list.
insn
- the instruction of this list that must be removed.
resetLabels
public void resetLabels()
Reset all labels in the instruction list. This method should be called
before reusing same instructions list between several
ClassWriter
s.
set
public void set(AbstractInsnNode location,
AbstractInsnNode insn)
Replaces an instruction of this list with another instruction.
location
- an instruction of this list.insn
- another instruction, which must not belong to any
InsnList
.
size
public int size()
Returns the number of instructions in this list.
- the number of instructions in this list.
toArray
public AbstractInsnNode[] toArray()
Returns an array containing all of the instructions in this list.
- an array containing all of the instructions in this list.