-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctionarrary.java
52 lines (44 loc) · 1.28 KB
/
Functionarrary.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
import java.util.ArrayList;
public class Functionarrary {
public ArrayList<Function> functions = new ArrayList<>();
private Functionarrary() {
}
private static Functionarrary function_arry = new Functionarrary();
public static Functionarrary getFunctionTable() { return function_arry; }
public Function getCurrentFuction(){
int len = Functionarrary.getFunctionTable().functions.size();
if(len==0)
return null;
return Functionarrary.getFunctionTable().functions.get(len-1);
}
public boolean is_function(String name) {
int len = functions.size(),i=0;
while(i<len)
{
if (functions.get(i).name.equals(name))
return true;
i++;
}
return false;
}
public Function get_function(String name){
int len = functions.size(),i=0;
while(i<len)
{
if (functions.get(i).name.equals(name))
return functions.get(i);
i++;
}
return null;
}
public int get_index(String name){
int len = functions.size(),i=0;
while(i<len)
{
if (functions.get(i).name.equals(name))
return i;
i++;
}
return -1;
}
}