Methods Summary |
---|
public boolean | contentEquals(com.android.dx.rop.code.InsnList b)Compares the contents of this {@code InsnList} with another.
The blocks must have the same number of insns, and each Insn must
also return true to {@code Insn.contentEquals()}.
if (b == null) return false;
int sz = size();
if (sz != b.size()) return false;
for (int i = 0; i < sz; i++) {
if (!get(i).contentEquals(b.get(i))) {
return false;
}
}
return true;
|
public void | forEach(Insn.Visitor visitor)Visits each instruction in the list, in order.
int sz = size();
for (int i = 0; i < sz; i++) {
get(i).accept(visitor);
}
|
public Insn | get(int n)Gets the element at the given index. It is an error to call
this with the index for an element which was never set; if you
do that, this will throw {@code NullPointerException}.
return (Insn) get0(n);
|
public Insn | getLast()Gets the last instruction. This is just a convenient shorthand for
{@code get(size() - 1)}.
return get(size() - 1);
|
public void | set(int n, Insn insn)Sets the instruction at the given index.
set0(n, insn);
|
public com.android.dx.rop.code.InsnList | withRegisterOffset(int delta)Returns an instance that is identical to this one, except that
the registers in each instruction are offset by the given
amount. Mutability of the result is inherited from the
original.
int sz = size();
InsnList result = new InsnList(sz);
for (int i = 0; i < sz; i++) {
Insn one = (Insn) get0(i);
if (one != null) {
result.set0(i, one.withRegisterOffset(delta));
}
}
if (isImmutable()) {
result.setImmutable();
}
return result;
|