示例#1
0
 public static void createData(String filePath) throws IOException {
   long time = System.currentTimeMillis();
   final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(filePath)));
   Random r = new Random(-1L);
   for (int nodes = 0; nodes < COUNT; nodes++) {
     writer.printf("%07d|%07d|%07d%n", nodes, r.nextInt(COUNT), r.nextInt(COUNT));
   }
   writer.close();
   System.out.println(
       "Creating data took " + (System.currentTimeMillis() - time) / 1000 + " seconds");
 }
示例#2
0
 public static void createJsonData(String filePath) throws IOException {
   long time = System.currentTimeMillis();
   final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(filePath)));
   Random r = new Random(-1L);
   int total = 100;
   for (int nodes = 0; nodes < total; nodes++) {
     // {"name" : "bar", relationships : [{"to" : "91", "type" : "LOVES", "data" : {"foo" :
     // "bar"}}]}
     // {"to" : "91", "type" : "LOVES", "data" : {"foo" : "bar"}}
     writer.printf("%07d|%07d|%07d%n", nodes, r.nextInt(total), r.nextInt(total));
   }
   writer.close();
   System.out.println(
       "Creating data took " + (System.currentTimeMillis() - time) / 1000 + " seconds");
 }