Esempio n. 1
0
  /**
   * Write the cluster and the segments to a CTL \e *FILE.
   *
   * @param dos the DataOutPutstream to write to
   * @throws IOException Signals that an I/O exception has occurred.
   */
  public void writeAsCTL(OutputStreamWriter dos) throws IOException {
    DecimalFormatSymbols dfs = new DecimalFormatSymbols();
    dfs.setDecimalSeparator('.');
    DecimalFormat df = new DecimalFormat();
    df.setDecimalFormatSymbols(dfs);
    df.setMaximumFractionDigits(2);
    df.setMinimumFractionDigits(2);
    df.setGroupingUsed(false);

    for (Segment seg : segmentSet) {
      float start = seg.getStartInSecond();
      float end = seg.getEndInSecond();
      String band = Segment.bandwidthNistStrings[0];
      if (seg.getBandwidth() == Segment.bandwidthStrings[1]) {
        band = Segment.bandwidthNistStrings[1];
      } else if (seg.getBandwidth() == Segment.bandwidthStrings[2]) {
        band = Segment.bandwidthNistStrings[2];
      }

      String line =
          seg.getShowName() + " " + seg.getStart() + " " + (seg.getStart() + seg.getLength());
      line += " " + seg.getShowName() + "-" + df.format(start) + "-" + df.format(end) + "-" + band;
      line += "-" + this.gender + "-" + name + "\n";
      dos.write(line);
    }
  }
Esempio n. 2
0
 /**
  * Write the cluster and the segments to a \e *FILE.
  *
  * @param dos the DataOutPutstream to write to
  * @throws IOException Signals that an I/O exception has occurred.
  */
 public void writeAsXSeg(OutputStreamWriter dos) throws IOException {
   String line = getInformations();
   if (line != "") {
     line = "audio cluster " + name + " " + getInformations() + "\n";
     dos.write(line);
   }
   for (Segment segment : segmentSet) {
     line =
         "audio segment "
             + segment.getShowName()
             + " "
             + segment.getChannel()
             + " "
             + segment.getStart();
     line += " " + segment.getLength() + " " + gender + " " + segment.getBandwidth();
     line += " " + segment.getEnvironement() + " " + name + segment.getInformations() + "\n";
     dos.write(line);
   }
 }
Esempio n. 3
0
 /**
  * Write the cluster and the segments to a \e *FILE.
  *
  * @param dos the DataOutPutstream to write to
  * @throws IOException Signals that an I/O exception has occurred.
  */
 public void writeAsSeg(OutputStreamWriter dos) throws IOException {
   Set<Entry<String, Object>> set = getInformation().entrySet();
   String info = "";
   for (Entry<String, Object> entry : set) {
     info += "[ " + entry.getKey() + " = " + entry.getValue().toString() + " ] ";
   }
   dos.write(";; cluster " + name + " " + info + "\n");
   String line;
   /*
    * String line = getInformations(); if (line != "") { line = ";; cluster:" + name + getInformations() + "\n"; dos.write(line); }
    */
   for (Segment segment : segmentSet) {
     line = segment.getShowName() + " " + segment.getChannel() + " " + segment.getStart();
     line += " " + segment.getLength() + " " + gender + " " + segment.getBandwidth();
     line += " " + segment.getEnvironement() + " " + name + segment.getInformations() + "\n";
     if (segment.getLength() > 0) {
       dos.write(line);
     }
   }
 }