Skip to content

Commit 34092cb

Browse files
committed
re
1 parent 1729799 commit 34092cb

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package cn.com.mirror.analyser.visitor;
22

33
import cn.com.mirror.constant.ControlNodeTypeEnum;
4-
import cn.com.mirror.project.pair.Vertex;
54
import cn.com.mirror.constant.VertexTypeEnum;
5+
import cn.com.mirror.project.pair.Vertex;
66
import cn.com.mirror.utils.AstUtils;
77
import lombok.Getter;
88
import lombok.extern.slf4j.Slf4j;
@@ -94,6 +94,7 @@ private boolean markCtrlEdge(int curLine,
9494
return false;
9595
}
9696

97+
// TODO xyz vertex might not need to create all the time, use a cache and generate from it
9798
Vertex head = new Vertex(this.targetPath, curLine, checkVertexType(astNode), null, -1);
9899
Vertex tail = new Vertex(this.targetPath, parentLine, checkVertexType(parent), null, -1);
99100
ctrlEdges.put(head, tail);
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 GenerateNodeException extends RuntimeException {
9+
private static final long serialVersionUID = 1L;
10+
11+
public GenerateNodeException(String message) {
12+
super(message);
13+
}
14+
15+
public GenerateNodeException(String message, Throwable cause) {
16+
super(message, cause);
17+
}
18+
}

mirror-common/src/main/java/cn/com/mirror/reflect/EdgeConstructor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ public void construct() {
5555

5656
// basic control edges in the target file
5757
ctrlEdge.forEach((ctrlKey, ctrlVal) -> {
58-
// TODO xyz generate nodes and construct control edges based on the work before
5958
log.debug("TARGET: {}", targetPath);
6059
log.debug("FROM: {}:{} \t->\t TO: {}:{}", ctrlKey.getLineNum(),
6160
ctrlKey.getVertexType(), ctrlVal.getLineNum(), ctrlVal.getVertexType());
6261

63-
Base headB = genBase(ctrlKey);
64-
Base tailB = genBase(ctrlVal);
62+
Base headB = getBaseElement(ctrlKey);
63+
Base tailB = getBaseElement(ctrlVal);
6564

65+
// TODO xyz generate start and end node for this target and write it into the graph db.
6666
BaseNode newGraphNodeTail = touch(headB, tailB);
6767
graphEngine.write(newGraphNodeTail);
6868

@@ -104,7 +104,7 @@ public BaseNode touch(Base headB, Base tailB) {
104104
return headNode;
105105
}
106106

107-
private Base genBase(Vertex vertex) {
107+
private Base getBaseElement(Vertex vertex) {
108108
switch (vertex.getVertexType()) {
109109
case CLASS: {
110110
Set<Class> classes = unit.getClasses().get(vertex.getTargetPath());

mirror-common/src/main/java/cn/com/mirror/repository/neo4j/node/BaseNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class BaseNode implements Serializable {
3030
@Property(name = "target path")
3131
private String targetPath;
3232

33-
@Property(name = "details in this line")
33+
// @Property(name = "details in this line")
3434
private String content;
3535

3636
@Property(name = "package name")

0 commit comments

Comments
 (0)