Beispiel #1
0
  public static Episode deepCopy(Episode episode, Factory factory) {
    Episode clone = factory.newEpisode();
    for (String key : episode.keys()) {
      clone.setAttribute(key, episode.getAttribute(key));
    }

    for (Segment act : episode.getActivities()) {
      Segment actClone = shallowCopy(act, factory);
      clone.addActivity(actClone);
    }

    for (Segment leg : episode.getLegs()) {
      Segment legClone = shallowCopy(leg, factory);
      clone.addLeg(legClone);
    }

    return clone;
  }