Пример #1
0
  public void writeFeatures(PrintWriter fout) throws IOException {
    // write the number of features
    fout.println(Integer.toString(features.size()));

    for (int i = 0; i < features.size(); i++) {
      Feature f = (Feature) features.get(i);
      fout.println(f.toString(data.cpInt2Str, data.lbInt2Str));
    }

    // wirte the line ###...
    fout.println(Option.modelSeparator);
  }
Пример #2
0
 /**
  * Write a feature file, overwriting any existing file
  *
  * @param feature The feature to write to disk
  * @throws MojoExecutionException If there is a problem writing the file
  */
 private void writeFeatureFile(Feature feature) throws MojoExecutionException {
   Writer writer = null;
   try {
     File outputFile = new File(outputDir, feature.getFile().toString());
     getLog().debug(String.format("Writing feature to %s", outputFile));
     writer = new BufferedWriter(new FileWriter(outputFile));
     writer.write(feature.toString());
     writer.flush();
   } catch (IOException ie) {
     throw new MojoExecutionException("Problem writing feature", ie);
   } finally {
     if (writer != null) {
       try {
         writer.close();
       } catch (IOException ie) {
         throw new MojoExecutionException("Problem writing feature", ie);
       }
     }
   }
 }
Пример #3
0
 @Override
 public void storeInBundle(Bundle bundle) {
   bundle.put(FEATURE, feature.toString());
   bundle.put(DEPTH, depth);
 }