| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectsysModel.classFile.code.InstructionList
public class InstructionList
Represents a list of Java instructions.
| Field Summary | |
|---|---|
protected  short | 
_index
 | 
(package private)  java.util.LinkedList<AInstruction> | 
_instructionList
 | 
(package private)  LineNumberTable | 
_lnt
 | 
| Constructor Summary | |
|---|---|
InstructionList(byte[] code)
Constructor.  | 
|
InstructionList(byte[] code,
                               short index)
Constructor.  | 
|
InstructionList(InstructionList original)
Copy constructor.  | 
|
| Method Summary | |
|---|---|
 boolean | 
advanceIndex()
Advance the program index to the next instruction.  | 
 boolean | 
advanceIndex(int count)
Advance the program index by multiple instructions.  | 
 boolean | 
deleteInstr(CodeAttributeInfo codeAttribute)
This method deletes the instruction at the program index.  | 
 boolean | 
equals(java.lang.Object o)
Return true if this instruction list and the other object are equal.  | 
 boolean | 
findInstruction(AInstruction instr)
Finds the next instruction that matches the specified instruction completely and moves the program counter there.  | 
 boolean | 
findOpcode(byte opcode)
Finds the next instruction with the specified opcode and moves the program counter there.  | 
 byte[] | 
getCode()
Accessor for the bytecode.  | 
 short | 
getIndex()
Accessor for the program index.  | 
 AInstruction | 
getInstr()
Return the instruction at the program index.  | 
 short | 
getLength()
Get the length of the instruction list.  | 
 byte | 
getOpcode()
Return the opcode at the program index.  | 
 short | 
getPCFromIndex(short index)
Calculate the PC for an index.  | 
 int | 
hashCode()
Return hash code.  | 
 void | 
insertBeforeInstr(AInstruction instr,
                                   CodeAttributeInfo codeAttribute)
This method inserts the instruction before the program counter.  | 
 void | 
insertInstr(AInstruction instr,
                       CodeAttributeInfo codeAttribute)
This method inserts the instruction at the program counter.  | 
protected  void | 
relocateBranches(AInstruction relocInstr,
                                 int ip)
Relocate branches in the instruction.  | 
 boolean | 
rewindIndex()
Rewind the program index to the previous instruction.  | 
 boolean | 
rewindIndex(int count)
Rewind the program index by multiple instructions.  | 
 void | 
setCode(byte[] code)
Mutator for the bytecode.  | 
 void | 
setIndex(int index)
Mutator for the program index.  | 
 java.lang.String | 
toString()
Return a human-readable version of the code.  | 
 java.lang.String | 
toString(boolean lineNumbers,
                 boolean PCs)
Return a human-readable version of the code.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
java.util.LinkedList<AInstruction> _instructionList
protected short _index
LineNumberTable _lnt
| Constructor Detail | 
|---|
public InstructionList(byte[] code)
code - bytecodepublic InstructionList(InstructionList original)
original - original
public InstructionList(byte[] code,
                       short index)
                throws java.lang.IndexOutOfBoundsException
code - bytecodeindex - program index.
java.lang.IndexOutOfBoundsException| Method Detail | 
|---|
public java.lang.String toString()
toString in class java.lang.Object
public java.lang.String toString(boolean lineNumbers,
                                 boolean PCs)
lineNumbers - print line numbersPCs - print PC values
public byte[] getCode()
               throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic void setCode(byte[] code)
code - bytecodepublic short getIndex()
public short getPCFromIndex(short index)
index - index
public short getLength()
public void setIndex(int index)
              throws java.lang.IndexOutOfBoundsException,
                     java.lang.IllegalArgumentException
index - new program index
java.lang.IndexOutOfBoundsException
java.lang.IllegalArgumentExceptionpublic boolean advanceIndex(int count)
count - number of instructions
public boolean advanceIndex()
public boolean rewindIndex(int count)
count - number of instructions
public boolean rewindIndex()
public byte getOpcode()
public AInstruction getInstr()
public boolean deleteInstr(CodeAttributeInfo codeAttribute)
codeAttribute - CodeAttribute that contains this code block, or null if none
public void insertInstr(AInstruction instr,
                        CodeAttributeInfo codeAttribute)
codeAttribute - CodeAttribute that contains this code block, or null if noneinstr - instruction to be inserted
protected void relocateBranches(AInstruction relocInstr,
                                int ip)
relocInstr - instruction whose branches should be relocatedip - insertion point
public void insertBeforeInstr(AInstruction instr,
                              CodeAttributeInfo codeAttribute)
codeAttribute - CodeAttribute that contains this code block, or null if noneinstr - instruction to be insertedpublic boolean findOpcode(byte opcode)
opcode - opcode to find
public boolean findInstruction(AInstruction instr)
instr - instruction to find
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - other object
public int hashCode()
hashCode in class java.lang.Object
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||