1 package jrre;
2
3 import jrre.types.*;
4 /***
5 * For containing the local variables in a
6 * stack frame.
7 */
8 public class LocalVariableFrame {
9
10 private int size;
11 private Type [] localVariables;
12
13 /***
14 * LocalVariables[size] should be calculated.
15 */
16 public LocalVariableFrame(){
17
18 localVariables = new Type[100];
19 size = 100;
20 }
21
22 /***
23 * Gets the LocalVariables.
24 */
25 public Type [] getLocalVariables(){
26 return this.localVariables;
27 }
28
29 /***
30 * Sets the LocalVariables.
31 * @param LocalVariables The value to set it to.
32 */
33 public void setLocalVariables(Type [] localVariables){
34 this.localVariables = localVariables;
35 }
36
37 /***
38 * Gets the Size.
39 */
40 public int getSize(){
41 return this.size;
42 }
43
44 /***
45 * Sets the Size.
46 * @param Size The value to set it to.
47 */
48 public void setSize(int size){
49 this.size = size;
50 localVariables = new Type[size+2];
51 }
52
53 public Type getLocalVariable(int variableNumber){
54 return localVariables[variableNumber];
55 }
56
57 public void setLocalVariable(int variableNumber, Type value){
58
59 //System.out.println("LV Frame: array length: "+localVariables.length);
60 //System.out.println("LV Frame: set - index: "+variableNumber+" value: "+value);
61 localVariables[variableNumber] = value;
62 }
63
64 }
This page was automatically generated by Maven