本文整理汇总了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;
}