Skip to content

Commit 35a916d

Browse files
committed
Update ConstructGroum
1 parent 7e956fb commit 35a916d

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/ConstructGroum.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ public Groum constructGroum(String groumPath,Map<String,String> apiMap){
4141
// int startLine = Integer.parseInt(startLineString);
4242
// int endLine = Integer.parseInt(endLineString);
4343
// GroumNode node = new GroumNode(id,api,originApi,startLine,endLine);
44-
GroumNode node = new GroumNode(id,api,originApi,-1,-1);
45-
groum.addNode(node);
44+
if(api.equals("-1")) {
45+
GroumNode node = new GroumNode(id, api, originApi, -1, -1);
46+
groum.addNode(node);
47+
}
4648
}
4749

4850

src/WritePathResult.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ public static void ergodicDir(File dir, PrintWriter targetFilePW, Map<String, St
3131
private static void writePath(File groumFile, PrintWriter targetFilePW, Map<String, String> API2IndexMap) throws IOException {
3232
ConstructGroum CG = new ConstructGroum();
3333
Groum groum = CG.constructGroum(groumFile.getAbsolutePath(), API2IndexMap);
34-
Map<String, GroumNode> nodeMap = groum.getNodeMap();
35-
List<String> startList = null;
36-
for (String id : nodeMap.keySet()) {
37-
startList = new ArrayList<>();
38-
startList.add(id);
39-
List<List<String>> outList = GetPath.getAllPath(groum, startList, 4);
40-
writeFile(outList, targetFilePW);
34+
if(groum != null) {
35+
Map<String, GroumNode> nodeMap = groum.getNodeMap();
36+
List<String> startList = null;
37+
for (String id : nodeMap.keySet()) {
38+
startList = new ArrayList<>();
39+
startList.add(id);
40+
List<List<String>> outList = GetPath.getAllPath(groum, startList, 4);
41+
writeFile(outList, targetFilePW);
42+
}
4143
}
4244
}
4345

0 commit comments

Comments
 (0)