예제 #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);
  }