本文整理匯總了Java中org.objectweb.asm.tree.InsnList.getLast方法的典型用法代碼示例。如果您正苦於以下問題:Java InsnList.getLast方法的具體用法?Java InsnList.getLast怎麽用?Java InsnList.getLast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.objectweb.asm.tree.InsnList
的用法示例。
在下文中一共展示了InsnList.getLast方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: matches
import org.objectweb.asm.tree.InsnList; //導入方法依賴的package包/類
/**
* <p>matches</p>
*
* @param instructions a {@link org.objectweb.asm.tree.InsnList} object.
* @return a boolean.
*/
public boolean matches(InsnList instructions) {
int match = 0;
AbstractInsnNode node = instructions.getFirst();
while (node != instructions.getLast()) {
if (node.getType() == AbstractInsnNode.FRAME
|| node.getType() == AbstractInsnNode.LABEL
|| node.getType() == AbstractInsnNode.LINE) {
node = node.getNext();
continue;
} else {
boolean found = false;
for (int opcode : pattern[match]) {
if (node.getOpcode() == opcode) {
match++;
found = true;
break;
}
}
if (!found)
match = 0;
}
if (match == pattern.length)
return true;
node = node.getNext();
}
return false;
}
示例2: getNextMatch
import org.objectweb.asm.tree.InsnList; //導入方法依賴的package包/類
/**
* <p>getNextMatch</p>
*
* @param start a {@link org.objectweb.asm.tree.AbstractInsnNode} object.
* @param instructions a {@link org.objectweb.asm.tree.InsnList} object.
* @return a {@link org.objectweb.asm.tree.AbstractInsnNode} object.
*/
public AbstractInsnNode getNextMatch(AbstractInsnNode start, InsnList instructions) {
int match = 0;
AbstractInsnNode node = start;
AbstractInsnNode startNode = start;
while (node != instructions.getLast()) {
if (node.getType() == AbstractInsnNode.FRAME
|| node.getType() == AbstractInsnNode.LABEL
|| node.getType() == AbstractInsnNode.LINE) {
node = node.getNext();
continue;
} else {
boolean found = false;
for (int opcode : pattern[match]) {
if (node.getOpcode() == opcode) {
if (match == 0)
startNode = node;
match++;
found = true;
break;
}
}
if (!found)
match = 0;
}
if (match == pattern.length) {
return startNode;
}
node = node.getNext();
}
return null;
}