public class InsnList extends Object
AbstractInsnNode
objects. This
implementation is not thread safe.Modifier and Type | Field and Description |
---|---|
static boolean |
check
Indicates if preconditions of methods of this class must be checked.
|
Constructor and Description |
---|
InsnList() |
Modifier and Type | Method and Description |
---|---|
void |
accept(MethodVisitor mv)
Makes the given visitor visit all of the instructions in this list.
|
void |
add(AbstractInsnNode insn)
Adds the given instruction to the end of this list.
|
void |
add(InsnList insns)
Adds the given instructions to the end of this list.
|
void |
clear()
Removes all of the instructions of this list.
|
boolean |
contains(AbstractInsnNode insn)
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 insn)
Returns the index of the given instruction in this list.
|
void |
insert(AbstractInsnNode insn)
Inserts the given instruction at the begining of this list.
|
void |
insert(AbstractInsnNode location,
AbstractInsnNode insn)
Inserts the given instruction after the specified instruction.
|
void |
insert(AbstractInsnNode location,
InsnList insns)
Inserts the given instructions after the specified instruction.
|
void |
insert(InsnList insns)
Inserts the given instructions at the begining of this list.
|
void |
insertBefore(AbstractInsnNode location,
AbstractInsnNode insn)
Inserts the given instruction before the specified instruction.
|
void |
insertBefore(AbstractInsnNode location,
InsnList insns)
Inserts the given instructions before the specified instruction.
|
ListIterator |
iterator()
Returns an iterator over the instructions in this list.
|
ListIterator |
iterator(int index)
Returns an iterator over the instructions in this list.
|
void |
remove(AbstractInsnNode insn)
Removes the given instruction from this list.
|
void |
resetLabels()
Reset all labels in the instruction list.
|
void |
set(AbstractInsnNode location,
AbstractInsnNode insn)
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 of the instructions in this list.
|
public static boolean check
indexOf
,
set
, insert(AbstractInsnNode, AbstractInsnNode)
,
insert(AbstractInsnNode, InsnList)
, remove
and
clear()
methods to execute in O(n) time instead of O(1).public int size()
public AbstractInsnNode getFirst()
public AbstractInsnNode getLast()
public AbstractInsnNode get(int index)
index
- the index of the instruction that must be returned.IndexOutOfBoundsException
- if (index < 0 || index >= size()).public boolean contains(AbstractInsnNode insn)
insn
- an instruction.public int indexOf(AbstractInsnNode insn)
insn
- an instruction of this list.contains
to test if an
instruction belongs to an instruction list or not.IllegalArgumentException
- if check
is true and
if insn does not belong to this list.public void accept(MethodVisitor mv)
mv
- the method visitor that must visit the instructions.public ListIterator iterator()
public ListIterator iterator(int index)
public AbstractInsnNode[] toArray()
public void set(AbstractInsnNode location, AbstractInsnNode insn)
location
- an instruction of this list.insn
- another instruction, which must not belong to any
InsnList
.IllegalArgumentException
- if check
is true,
and if i does not belong to this list or if insn belongs to an
instruction list.public void add(AbstractInsnNode insn)
insn
- an instruction, which must not belong to any
InsnList
.IllegalArgumentException
- if check
is true,
and if insn belongs to an instruction list.public void add(InsnList insns)
insns
- an instruction list, which is cleared during the process.IllegalArgumentException
- if check
is true,
and if insn == this.public void insert(AbstractInsnNode insn)
insn
- an instruction, which must not belong to any
InsnList
.IllegalArgumentException
- if check
is true,
and if insn belongs to an instruction list.public void insert(InsnList insns)
insns
- an instruction list, which is cleared during the process.IllegalArgumentException
- if check
is true,
and if insn == this.public void insert(AbstractInsnNode location, AbstractInsnNode insn)
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
.IllegalArgumentException
- if check
is true,
and if i does not belong to this list or if insn belongs to an
instruction list.public void insert(AbstractInsnNode location, InsnList insns)
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.IllegalArgumentException
- if check
is true,
and if i does not belong to this list or if insns == this.public void insertBefore(AbstractInsnNode location, AbstractInsnNode insn)
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
.IllegalArgumentException
- if check
is true,
and if i does not belong to this list or if insn belongs to an
instruction list.public void insertBefore(AbstractInsnNode location, InsnList insns)
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.IllegalArgumentException
- if check
is true,
and if i does not belong to this list or if insns == this.public void remove(AbstractInsnNode insn)
insn
- the instruction of this list that must be removed.IllegalArgumentException
- if check
is true,
and if insn does not belong to this list.public void clear()
public void resetLabels()
ClassWriter
s.Copyright © 2018. All rights reserved.