Example #1
0
  /**
   * Merge several graphs in one. The first parameter is the graph in which the other graphs will be
   * merged.
   *
   * @param result destination graph.
   * @param graphs all graphs that will be merged in result.
   */
  public static void mergeIn(Graph result, Graph... graphs) {
    boolean strict = result.isStrict();
    GraphReplay replay = new GraphReplay(String.format("replay-%x", System.nanoTime()));

    replay.addSink(result);
    result.setStrict(false);

    if (graphs != null) for (Graph g : graphs) replay.replay(g);

    replay.removeSink(result);
    result.setStrict(strict);
  }
Example #2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.graphstream.stream.file.FileSink#writeAll(org.graphstream.graph.Graph
   * , java.lang.String)
   */
  public synchronized void writeAll(Graph g, String filename) throws IOException {
    clearGG();

    GraphReplay replay =
        new GraphReplay(String.format("file_sink_image-write_all-replay-%x", System.nanoTime()));

    replay.addSink(gg);
    replay.replay(g);
    replay.removeSink(gg);

    outputNewImage(filename);

    clearGG();
  }