TechTrader Bytecode Toolkit

com.techtrader.modules.tools.bytecode
Class ArrayInstruction

java.lang.Object
  |
  +--com.techtrader.modules.tools.bytecode.Instruction
        |
        +--com.techtrader.modules.tools.bytecode.ArrayInstruction
Direct Known Subclasses:
ArrayLoadInstruction, ArrayStoreInstruction

public abstract class ArrayInstruction
extends Instruction

Represents any array load or store instruction.

Author:
Abe White

Field Summary
protected  Class _type
           
protected static Map _typeNames
           
 
Fields inherited from class com.techtrader.modules.tools.bytecode.Instruction
_byteIndex, _opcode, _opcodeTypes, _owner
 
Constructor Summary
protected ArrayInstruction(Code owner)
           
protected ArrayInstruction(Code owner, int opcode, Class type)
           
 
Method Summary
protected abstract  void calculateOpCode()
          Subclasses with variable opcodes can use this method to be notified that information possibly affecting the opcode has been changed.
protected  void copy(Instruction orig)
           
 boolean equals(Object other)
          Two array instructions are equal if the index and type they reference are equal or if either index is 0/unset.
 Class getType()
          Get the type of array to load; this is one of: int, float, double, long, char, byte, short, or Object.class.
 String getTypeName()
          Get the type of array to load; this is one of: int, float, double, long, char, byte, short, or java.lang.Object.
 ArrayInstruction setType(Class type)
          Set the type of array to load; Object types other than Object.class will be demoted to Object.class, and primitives that have no direct support (boolean) will be converted to int.class.
 ArrayInstruction setTypeName(String name)
          Set the type to load by name.
 
Methods inherited from class com.techtrader.modules.tools.bytecode.Instruction
acceptVisit, getByteIndex, getLength, getName, getOpCode, getOwner, getStackChange, invalidate, readData, setByteIndex, setOpCode, writeData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_typeNames

protected static final Map _typeNames

_type

protected Class _type
Constructor Detail

ArrayInstruction

protected ArrayInstruction(Code owner)

ArrayInstruction

protected ArrayInstruction(Code owner,
                           int opcode,
                           Class type)
Method Detail

getType

public Class getType()
Get the type of array to load; this is one of: int, float, double, long, char, byte, short, or Object.class. If the type has not been set, this method will return null.

getTypeName

public String getTypeName()
Get the type of array to load; this is one of: int, float, double, long, char, byte, short, or java.lang.Object. If the type has not been set, this method will return null.

setType

public ArrayInstruction setType(Class type)
Set the type of array to load; Object types other than Object.class will be demoted to Object.class, and primitives that have no direct support (boolean) will be converted to int.class.
Returns:
this Instruction, for method chaining

setTypeName

public ArrayInstruction setTypeName(String name)
Set the type to load by name.
Returns:
this Instruction, for method chaining
See Also:
setType(java.lang.Class)

equals

public boolean equals(Object other)
Two array instructions are equal if the index and type they reference are equal or if either index is 0/unset.
Overrides:
equals in class Instruction

copy

protected void copy(Instruction orig)
Overrides:
copy in class Instruction

calculateOpCode

protected abstract void calculateOpCode()
Subclasses with variable opcodes can use this method to be notified that information possibly affecting the opcode has been changed.

TechTrader Bytecode Toolkit