public class InsnSequence
extends org.objectweb.asm.tree.InsnList
InsnList
, but provides additional flexibility and features.Constructor and Description |
---|
InsnSequence()
Public constructor.
|
InsnSequence(org.objectweb.asm.tree.AbstractInsnNode node)
Public constructor for list with single item.
|
InsnSequence(org.objectweb.asm.tree.AbstractInsnNode startNode,
org.objectweb.asm.tree.AbstractInsnNode endNode)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(org.objectweb.asm.tree.AbstractInsnNode... nodes)
Adds an array of nodes to the list.
|
void |
add(org.objectweb.asm.tree.AbstractInsnNode node)
Wraps InsnList's add() to throw an exception
when given null values.
|
void |
cut(int amount,
boolean reverse)
Cut a number of nodes from the list.
|
org.objectweb.asm.tree.AbstractInsnNode |
get(int index)
Extends the existing get function from InsnList to allow for negative indexes.
|
boolean |
replace(int opcode,
org.objectweb.asm.tree.AbstractInsnNode newNode,
int amount)
Replaces n occurrences of said opcode with the given node.
|
boolean |
replace(int opcode,
org.objectweb.asm.tree.AbstractInsnNode newNode,
int amount,
boolean reverse)
Replaces n occurrences of said opcode with the given node.
|
void |
replaceNode(org.objectweb.asm.tree.AbstractInsnNode oldNode,
org.objectweb.asm.tree.AbstractInsnNode newNode)
Replaces a node with another one.
|
accept, add, clear, contains, getFirst, getLast, indexOf, insert, insert, insert, insert, insertBefore, insertBefore, iterator, iterator, remove, resetLabels, set, size, toArray
public InsnSequence()
public InsnSequence(org.objectweb.asm.tree.AbstractInsnNode node)
node
- the node in questionpublic InsnSequence(org.objectweb.asm.tree.AbstractInsnNode startNode, org.objectweb.asm.tree.AbstractInsnNode endNode)
startNode
- the starting node of the patternendNode
- the first node of the patternpublic org.objectweb.asm.tree.AbstractInsnNode get(int index)
get
in class org.objectweb.asm.tree.InsnList
index
- the index of the instruction that must be returnedpublic void add(org.objectweb.asm.tree.AbstractInsnNode... nodes)
nodes
- the nodes to addpublic void add(org.objectweb.asm.tree.AbstractInsnNode node)
add
in class org.objectweb.asm.tree.InsnList
node
- to addpublic void replaceNode(org.objectweb.asm.tree.AbstractInsnNode oldNode, org.objectweb.asm.tree.AbstractInsnNode newNode)
oldNode
- node to replacenewNode
- new nodepublic boolean replace(int opcode, org.objectweb.asm.tree.AbstractInsnNode newNode, int amount)
opcode
- the opcode to replacenewNode
- the replacement nodeamount
- how many occurrences to replace, set to 0 to replace allpublic boolean replace(int opcode, org.objectweb.asm.tree.AbstractInsnNode newNode, int amount, boolean reverse)
opcode
- the opcode to replacenewNode
- the replacement nodereverse
- whether the search should be done from the endamount
- how many occurrences to replace, set to 0 to replace allpublic void cut(int amount, boolean reverse)
amount
- how many nodes to cutreverse
- true if should cut from the end, false otherwise