-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMethod.java
More file actions
60 lines (43 loc) · 1.39 KB
/
Method.java
File metadata and controls
60 lines (43 loc) · 1.39 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
import org.eclipse.jdt.core.dom.*;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
import java.util.Set;
import java.util.HashSet;
public class Method implements Serializable {
// list of statements with its respective token values
ArrayList<Statement> bodyStatements = new ArrayList<Statement>();
int methodStartLine;
int methodEndLine;
public Method(int startLine) {
methodStartLine = startLine;
}
public void setEndLine(int endLine) {
methodEndLine = endLine;
}
public int getStart() {
return methodStartLine;
}
public int getEnd() {
return methodEndLine;
}
public void addStatement(int value, int startLine, int endLine,
boolean hasMethodInvocation, int scopeLevel,
HashSet<String> simpleNameList,
HashSet<String> varNameList) {
Statement statement = new Statement(value, startLine, endLine);
statement.insertScope(scopeLevel);
statement.insertNameList(simpleNameList);
statement.insertVarList(varNameList);
if (hasMethodInvocation) {
statement.enableMethodInvocation();
}
bodyStatements.add(statement);
}
public ArrayList<Statement> getMethodStatements() {
return bodyStatements;
}
public int getNumStatements() {
return bodyStatements.size();
}
}