edu.arizona.cs.mbel.instructions
Class CASTCLASS

java.lang.Object
  extended byedu.arizona.cs.mbel.instructions.Instruction
      extended byedu.arizona.cs.mbel.instructions.CASTCLASS

public class CASTCLASS
extends Instruction

Casts an object to a given class type.
Stack transition:
..., obj1 --> ..., obj2


Field Summary
static int CASTCLASS
           
protected static int[] OPCODE_LIST
           
 
Constructor Summary
CASTCLASS(AbstractTypeReference ref)
          Makes a CASTCLASS object with the given type reference
CASTCLASS(int opcode, ClassParser parse)
           
 
Method Summary
protected  void emit(ByteBuffer buffer, ClassEmitter emitter)
          Writes the instruction to the given buffer in raw byte form
 boolean equals(java.lang.Object o)
           
 int getLength()
          Returns the length in bytes of this instruction, as would be found on disk.
 java.lang.String getName()
          Returns the string representation of this instruction (may vary instance-to-instance)
 AbstractTypeReference getType()
          Returns the type reference for this instruction
 
Methods inherited from class edu.arizona.cs.mbel.instructions.Instruction
getOpcode, readInstruction, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CASTCLASS

public static final int CASTCLASS
See Also:
Constant Field Values

OPCODE_LIST

protected static final int[] OPCODE_LIST
Constructor Detail

CASTCLASS

public CASTCLASS(AbstractTypeReference ref)
          throws InstructionInitException
Makes a CASTCLASS object with the given type reference

Parameters:
ref - the type reference for this instruction

CASTCLASS

public CASTCLASS(int opcode,
                 ClassParser parse)
          throws java.io.IOException,
                 InstructionInitException
Method Detail

getName

public java.lang.String getName()
Description copied from class: Instruction
Returns the string representation of this instruction (may vary instance-to-instance)

Specified by:
getName in class Instruction
Returns:
a string representing this instruction (i.e. "cpblk")

getType

public AbstractTypeReference getType()
Returns the type reference for this instruction


getLength

public int getLength()
Description copied from class: Instruction
Returns the length in bytes of this instruction, as would be found on disk. This value includes any prefixes prepended to this instruction.

Overrides:
getLength in class Instruction

emit

protected void emit(ByteBuffer buffer,
                    ClassEmitter emitter)
Description copied from class: Instruction
Writes the instruction to the given buffer in raw byte form

Overrides:
emit in class Instruction
Parameters:
buffer - the buffer to write to
emitter - a ClassEmitter for reconciling references to tokens

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Instruction