Skip to content

Commit 1729799

Browse files
committed
re
1 parent 2b70356 commit 1729799

File tree

14 files changed

+173
-96
lines changed

14 files changed

+173
-96
lines changed

mirror-common/src/main/java/cn/com/mirror/analyser/visitor/ControlEdgeVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import cn.com.mirror.constant.ControlNodeTypeEnum;
44
import cn.com.mirror.project.pair.Vertex;
5-
import cn.com.mirror.project.pair.VertexTypeEnum;
5+
import cn.com.mirror.constant.VertexTypeEnum;
66
import cn.com.mirror.utils.AstUtils;
77
import lombok.Getter;
88
import lombok.extern.slf4j.Slf4j;

mirror-common/src/main/java/cn/com/mirror/constant/EdgeType.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@
99
*/
1010
@Getter
1111
public enum EdgeType {
12-
CTRL_EDGE("1", "control dependence"),
13-
STAT_TO_MTD("2", "statements to method control edge"),
14-
MTD_TO_CLS("3", "method to class control edge"),
15-
DATA_EDGE("99", "simple date dependence");
12+
CTRL_EDGE(1, "control dependence"),
13+
STAT_TO_MTD(2, "statements to method control edge"),
14+
FID_TO_CLS(3, "field variable to class control edge"),
15+
MTD_TO_CLS(4, "method to class control edge"),
16+
DATA_EDGE(99, "simple date dependence");
1617

17-
private String key;
18+
private Integer key;
1819
private String desc;
1920

20-
private EdgeType(String key, String desc) {
21+
EdgeType(Integer key, String desc) {
2122
this.key = key;
2223
this.desc = desc;
2324
}
2425

2526
public interface TYPE {
2627
String CTRL_EDGE = "CTRL_EDGE";
2728
String STAT_TO_MTD = "STAT_TO_MTD";
29+
String FID_TO_CLS = "FID_TO_CLS";
2830
String MTD_TO_CLS = "MTD_TO_CLS";
2931
String DATA_EDGE = "DATA_EDGE";
3032
}
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
*
2+
*
33
*/
44
package cn.com.mirror.constant;
55

@@ -8,30 +8,29 @@
88

99
/**
1010
* @author Piggy
11-
*
1211
* @description
1312
* @date 2018年4月27日
1413
*/
1514
@Getter
1615
public enum NodeTypeEnum {
17-
PACKAGE("PACKAGE"),
18-
CLASS("CLASS"),
19-
METHOD("METHOD"),
20-
STATEMENT("STATEMENT");
16+
PACKAGE("PACKAGE"),
17+
CLASS("CLASS"),
18+
METHOD("METHOD"),
19+
STATEMENT("STATEMENT");
2120

22-
private NodeTypeEnum(String key) {
23-
this.key = key;
24-
}
21+
private String key;
2522

26-
private String key;
23+
private NodeTypeEnum(String key) {
24+
this.key = key;
25+
}
2726

28-
public static NodeTypeEnum getNodeTypeEnum(String key) {
29-
for (NodeTypeEnum nodeTypeEnum : NodeTypeEnum.values()) {
30-
if (nodeTypeEnum.getKey().equals(key)) {
31-
return nodeTypeEnum;
32-
}
33-
}
34-
throw new ConstantException("No node type match!");
35-
}
27+
public static NodeTypeEnum getNodeTypeEnum(String key) {
28+
for (NodeTypeEnum nodeTypeEnum : NodeTypeEnum.values()) {
29+
if (nodeTypeEnum.getKey().equals(key)) {
30+
return nodeTypeEnum;
31+
}
32+
}
33+
throw new ConstantException("No node type match!");
34+
}
3635

3736
}

mirror-common/src/main/java/cn/com/mirror/project/pair/VertexTypeEnum.java renamed to mirror-common/src/main/java/cn/com/mirror/constant/VertexTypeEnum.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cn.com.mirror.project.pair;
1+
package cn.com.mirror.constant;
22

33
import lombok.Getter;
44

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package cn.com.mirror.exceptions;
22

3-
public class AnalysisException extends RuntimeException{
4-
private static final long serialVersionUID = 1L;
5-
6-
public AnalysisException(String exception) {
7-
super(exception);
8-
}
3+
public class AnalysisException extends RuntimeException {
4+
private static final long serialVersionUID = 1L;
95

6+
public AnalysisException(String message) {
7+
super(message);
8+
}
9+
10+
public AnalysisException(String message, Throwable cause) {
11+
super(message, cause);
12+
}
1013
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
/**
2-
*
2+
*
33
*/
44
package cn.com.mirror.exceptions;
55

66
/**
77
* @author Piggy
8-
*
98
* @description
109
* @date 2018年4月27日
1110
*/
1211
public class ConstantException extends RuntimeException {
13-
private static final long serialVersionUID = 1L;
12+
private static final long serialVersionUID = 1L;
1413

15-
public ConstantException(String exception) {
16-
super(exception);
17-
}
14+
public ConstantException(String message) {
15+
super(message);
16+
}
1817

18+
public ConstantException(String message, Throwable cause) {
19+
super(message, cause);
20+
}
1921
}
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package cn.com.mirror.exceptions;
22

3-
public class ProjectException extends RuntimeException{
4-
private static final long serialVersionUID = 1L;
5-
6-
public ProjectException(String exception) {
7-
super(exception);
8-
}
3+
public class ProjectException extends RuntimeException {
4+
private static final long serialVersionUID = 1L;
95

6+
public ProjectException(String message) {
7+
super(message);
8+
}
9+
10+
public ProjectException(String message, Throwable cause) {
11+
super(message, cause);
12+
}
1013
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package cn.com.mirror.exceptions;
2+
3+
/**
4+
* @author piggy
5+
* @description
6+
* @date 18-8-23
7+
*/
8+
public class ReflectException extends RuntimeException {
9+
private static final long serialVersionUID = 1L;
10+
11+
public ReflectException(String message) {
12+
super(message);
13+
}
14+
15+
public ReflectException(String message, Throwable cause) {
16+
super(message, cause);
17+
}
18+
}

mirror-common/src/main/java/cn/com/mirror/project/pair/Pair.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@
1212
*/
1313
@Getter
1414
public class Pair {
15-
private Map<String, Map<Integer, Integer>> directCtrlEdges = new HashMap<>();
1615
private Map<String, Map<Vertex, Vertex>> ctrlEdges = new HashMap<>();
1716

18-
public void addDirectCtrlEdges(String targetPath, Map<Integer, Integer> ctrlEdges) {
19-
this.directCtrlEdges.put(targetPath, ctrlEdges);
20-
}
21-
2217
public void addCtrlEdge(String targetPath, Map<Vertex, Vertex> ctrlEdges) {
2318
this.ctrlEdges.put(targetPath, ctrlEdges);
2419
}

mirror-common/src/main/java/cn/com/mirror/project/pair/Vertex.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.com.mirror.project.pair;
22

3+
import cn.com.mirror.constant.VertexTypeEnum;
34
import lombok.Getter;
45

56
import java.io.Serializable;

0 commit comments

Comments
 (0)