Exemplo n.º 1
0
 private File convertNetToMat(ValidateNETFile vmf) {
   try {
     // System.out.println("Converting net to mat");
     File net = getTempFile();
     PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(net)));
     writeVertices(vmf, out);
     // System.out.println(vmf.isDirectedGraph() + " " + vmf.isUndirectedGraph());
     if (vmf.isDirectedGraph()) {
       // System.out.println("Directed");
       writeDirectedMatrix(vmf, out);
     } else {
       // System.out.println("Undirected");
       writeUndirectedMatrix(vmf, out);
     }
     out.close();
     return net;
   } catch (FileNotFoundException e) {
     logger.log(LogService.LOG_ERROR, "Unable to find the temporary .mat file.", e);
     return null;
   } catch (IOException ioe) {
     logger.log(LogService.LOG_ERROR, "IO Errors while writing to the temporary .mat file.", ioe);
     return null;
   }
 }