-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVariable.java
52 lines (42 loc) · 1.13 KB
/
Variable.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
public class Variable {
String type;
public String name;
String functionname;
int level;
boolean is_const;
boolean is_init;
boolean is_func=false;
public Variable() {
}
public Variable(String type, String name, boolean is_const, boolean is_init, int level) {
this.type = type;
this.name = name;
this.is_const = is_const;
this.is_init = is_init;
this.level =level;
}
public void setfunctionname(String functionname) {
this.functionname = functionname;
}
public void setfunc_true() {
this.is_func = true;
}
public String get_type(){return type;}
public void set_type(String type){this.type=type;}
public String getValue(){
if(!is_func && (type.equals("int") || type.equals("double"))){
String res = "";
for(int i=0;i<8;i++)
res += "\0";
return res;
}
return name;
}
public boolean judge_level(int level){
if(level == 0)
return true;
if (level<this.level)
return false;
return true;
}
}