-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathVariable.java
More file actions
69 lines (57 loc) · 1.01 KB
/
Copy pathVariable.java
File metadata and controls
69 lines (57 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//Mark Klara
//mak241@pitt.edu
//CS 1622 - Project 3
//Variable.java
package symboltable;
public class Variable
{
private String name;
private String type;
private int offset; //Used by class member variables for an offset
private String register; //Used by local variables to store the register string mapped to it by the register allocator
public Variable(String name, String type)
{
this.name = name;
this.type = type;
offset = -1;
register = null;
}
public Variable(String name, String type, int x)
{
this(name, type);
offset = x;
}
public Variable(String name, String type, String reg)
{
this(name, type);
register = reg;
}
public void setRegister(String reg)
{
register = reg;
}
public void setOffset(int x)
{
offset = x;
}
public String getName()
{
return name;
}
public String toString()
{
return getName();
}
public String getType()
{
return type;
}
public int getOffset()
{
return offset;
}
public String getRegister()
{
return register;
}
}