MCPcopy Create free account
hub / github.com/dsg-titech/simblock / writeGraph

Method writeGraph

simulator/src/main/java/simblock/simulator/Main.java:382–400  ·  view source on GitHub ↗
(int blockHeight)

Source from the content-addressed store, hash-verified

380 */
381 //TODO use logger
382 public static void writeGraph(int blockHeight) {
383 try {
384 FileWriter fw = new FileWriter(
385 new File(OUT_FILE_URI.resolve("./graph/" + blockHeight + ".txt")), false);
386 PrintWriter pw = new PrintWriter(new BufferedWriter(fw));
387
388 for (int index = 1; index <= getSimulatedNodes().size(); index++) {
389 Node node = getSimulatedNodes().get(index - 1);
390 for (int i = 0; i < node.getNeighbors().size(); i++) {
391 Node neighbor = node.getNeighbors().get(i);
392 pw.println(node.getNodeID() + " " + neighbor.getNodeID());
393 }
394 }
395 pw.close();
396
397 } catch (IOException ex) {
398 ex.printStackTrace();
399 }
400 }
401
402}

Callers 1

mainMethod · 0.95

Calls 3

getNeighborsMethod · 0.95
getNodeIDMethod · 0.95
getSimulatedNodesMethod · 0.80

Tested by

no test coverage detected