Example #1
0
  /**
   * Creates a deep copy of the cluster: segments in the new cluster are copies of the original
   * segments, not references.
   *
   * @return the object
   */
  @Override
  public Cluster clone() {
    Cluster result = null;
    try {
      result = (Cluster) (super.clone());
    } catch (CloneNotSupportedException e) {
      logger.log(Level.SEVERE, "", e);
      e.printStackTrace();
    }
    result.segmentSet = new TreeSet<Segment>();
    for (Segment segment : segmentSet) {
      result.segmentSet.add((segment.clone()));
    }
    result.informationMap = new TreeMap<String, Object>(new StringComparator());
    for (String key : informationMap.keySet()) {
      result.setInformation(key, informationMap.get(key));
    }

    result.modelScores = new ModelScores();
    for (String key : modelScores.keySet()) {
      result.modelScores.put(key, modelScores.get(key));
    }

    result.speakerNameSet = (SpeakerNameSet) speakerNameSet.clone();

    return result;
  }