View Javadoc
1 package jrre.instructionset.objects; 2 3 import jrre.*; 4 import jrre.types.*; 5 6 public class ANewArray extends jrre.instructionset.Instruction { 7 8 private int operandOne; 9 private int operandTwo; 10 11 public ANewArray(int operandOne,int operandTwo){ 12 13 name = "anewarray"; 14 description = "foo foo moo poo"; 15 length = 1; 16 17 this.operandOne = operandOne; 18 this.operandTwo = operandTwo; 19 } 20 21 /*** 22 * Executes the <strong><code>anewarray</code></strong> instruction. 23 * 24 * @param stackFrame 25 */ 26 public void execute(){ 27 28 int classIndex = (operandOne << 8) | operandTwo; 29 30 ArrayInstance newArray = new ArrayInstance(12,((PrimitiveType)Stack.popOperand()).getValue()); 31 32 String key = Integer.toString(newArray.hashCode()); 33 34 ObjectArea.addObject(key, newArray); 35 36 ReferenceType newReference = new ReferenceType(newArray); 37 Stack.pushOperand(newReference); 38 39 } 40 41 public String toString(){ 42 StringBuffer toReturn = new StringBuffer(); 43 toReturn.append("anewarray "); 44 toReturn.append(Integer.toHexString(operandOne)); 45 return toReturn.toString(); 46 } 47 }

This page was automatically generated by Maven