Ejemplo n.º 1
0
  /**
   * Saves the feature divide model settings .fsm file.
   *
   * @throws MaltChainedException
   */
  protected void save() throws MaltChainedException {
    try {
      final BufferedWriter out =
          new BufferedWriter(
              getGuide()
                  .getConfiguration()
                  .getConfigurationDir()
                  .getOutputStreamWriter(getModelName() + ".dsm"));
      out.write(masterModel.getIndex() + "\t" + masterModel.getFrequency() + "\n");

      if (divideModels != null) {
        for (AtomicModel divideModel : divideModels.values()) {
          out.write(divideModel.getIndex() + "\t" + divideModel.getFrequency() + "\n");
        }
      }
      out.close();
    } catch (IOException e) {
      throw new GuideException(
          "Could not write to the guide model settings file '"
              + getModelName()
              + ".dsm"
              + "', when "
              + "saving the guide model settings to file. ",
          e);
    }
  }