-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartcode.java
55 lines (46 loc) · 1.33 KB
/
startcode.java
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
import java.util.*;
public class startcode {
public ArrayList<Order> orders = new ArrayList<>();
public ArrayList<Variable> variables = new ArrayList<>();
private static startcode startCode_array = new startcode();
private startcode(){}
public static startcode getStartCodeTable() { return startCode_array; }
public boolean is_variable(String name) {
int len=variables.size();
int i=0;
while(i<len) {
if (variables.get(i).name.equals(name))
return true;
i++;
}
return false;
}
public boolean is_const(String name) {
int len=variables.size(),i=0;
while(i<len) {
if (variables.get(i).name.equals(name))
return variables.get(i).is_const;
i++;
}
return false;
}
public int get_index(String name) {
int len=variables.size(),i=0;
while(i<len) {
if (variables.get(i).name.equals(name))
return i;
i++;
}
return 0;
}
public Variable get_variable(String name){
int len = variables.size();
int i=0;
while(i<len) {
if (variables.get(i).name.equals(name))
return variables.get(i);
i++;
}
return null;
}
}