1 package jrre.instructionset.objects;
2
3 import jrre.*;
4 import jrre.types.*;
5 import jrre.classloader.classfile.pool_entries.*;
6
7 public class ArrayLength extends jrre.instructionset.Instruction {
8
9 private int operandOne;
10 private int operandTwo;
11
12 public ArrayLength(){
13
14 name = "arraylength "+operandOne+" "+operandTwo;
15 description = "hi there: 42.";
16 length = 0;
17 }
18
19 /***
20 * Executes the <strong><code>arraylength</code></strong> instruction.
21 *
22 */
23 public void execute(){
24
25 ReferenceType arrayRef = (ReferenceType)Stack.popOperand();
26 ArrayInstance arrayInstance = (ArrayInstance)arrayRef.getValue();
27
28 Stack.pushOperand(arrayInstance.getLength());
29
30 }
31
32 public String toString(){
33 StringBuffer toReturn = new StringBuffer();
34 toReturn.append("arraylength ");
35 return toReturn.toString();
36 }
37 }
This page was automatically generated by Maven