com.android.dx.rop.code
Class InsnList

java.lang.Object
  extended by com.android.dx.util.MutabilityControl
      extended by com.android.dx.util.FixedSizeList
          extended by com.android.dx.rop.code.InsnList
All Implemented Interfaces:
ToHuman

public final class InsnList
extends FixedSizeList

List of Insn instances.


Constructor Summary
InsnList(int size)
          Constructs an instance.
 
Method Summary
 boolean contentEquals(InsnList b)
          Compares the contents of this InsnList with another.
 void forEach(Insn.Visitor visitor)
          Visits each instruction in the list, in order.
 Insn get(int n)
          Gets the element at the given index.
 Insn getLast()
          Gets the last instruction.
 void set(int n, Insn insn)
          Sets the instruction at the given index.
 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.
 
Methods inherited from class com.android.dx.util.FixedSizeList
equals, get0, getOrNull0, hashCode, set0, shrinkToFit, size, toHuman, toHuman, toString, toString
 
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InsnList

public InsnList(int size)
Constructs an instance. All indices initially contain null.

Parameters:
size - the size of the list
Method Detail

get

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 NullPointerException.

Parameters:
n - >= 0, < size(); which index
Returns:
non-null; element at that index

set

public void set(int n,
                Insn insn)
Sets the instruction at the given index.

Parameters:
n - >= 0, < size(); which index
insn - non-null; the instruction to set at n

getLast

public Insn getLast()
Gets the last instruction. This is just a convenient shorthand for get(size() - 1).

Returns:
non-null; the last instruction

forEach

public void forEach(Insn.Visitor visitor)
Visits each instruction in the list, in order.

Parameters:
visitor - non-null; visitor to use

contentEquals

public boolean contentEquals(InsnList b)
Compares the contents of this InsnList with another. The blocks must have the same number of insns, and each Insn must also return true to Insn.contentEquals().

Parameters:
b - to compare
Returns:
true in the case described above.

withRegisterOffset

public 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.

Parameters:
delta - the amount to offset register numbers by
Returns:
non-null; an appropriately-constructed instance


Copyright © 2015. All rights reserved.