-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDecode.java
More file actions
45 lines (37 loc) · 788 Bytes
/
Decode.java
File metadata and controls
45 lines (37 loc) · 788 Bytes
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
import java.util.*;
import java.lang.String;
public class Decode {
private boolean isLoad;
private int op1;
private int op2;
private String instType;
//CONSTRUCTOR
public Decode() {
}
//performs the decode
public void doDecode(ArrayList<String> mbr) {
this.instType = mbr.get(0);
if (this.instType.equals("LOAD"))
this.isLoad = true;
else
this.isLoad = false;
this.op1 = Integer.parseInt(mbr.get(1).substring(1));
if (isLoad)
this.op2 = Integer.parseInt(mbr.get(2));
else
this.op2 = Integer.parseInt(mbr.get(2).substring(1));
}
//getters
public boolean getIsLoad() {
return this.isLoad;
}
public String getInstType() {
return this.instType;
}
public int getOp1() {
return this.op1;
}
public int getOp2() {
return this.op2;
}
}