upstream version 1.2.2
[debian/freetts] / tools / ArcticToFreeTTS / src / Unit.java
1 /**
2  * Simple Unit entry for the Catalog.
3  */
4 public class Unit {
5     public String unitType;
6     public int unitNum;
7     public String filename;
8     public float start;
9     public float middle;
10     public float end;
11     public Unit previous;
12     public Unit next;
13     public int index;
14     
15     /**
16      * Creates a new Unit entry for the catalog.
17      *
18      * @param unitType the type of this unit
19      * @param unitNum the index of this unit
20      * @param filename (without extension) where the audio and STS
21      * data for this unit can be found
22      * @param start the timing info (in seconds) for where the audio
23      * and STS data for this unit starts in filename
24      * @param middle the timing info (in seconds) for where the middle
25      * of the audio and STS data for this unit is in filename
26      * @param end the timing info (in seconds) for where the audio
27      * and STS data for this unit ends in filename
28      * @param previous the unit preceding this one in the recorded
29      * utterance
30      * @param next the unit following this one in the recorded
31      * utterance
32      * @param index the index of this unit in the overall catalog
33      */
34     public Unit(
35         String unitType,
36         int unitNum,
37         String filename,
38         float start,
39         float middle,
40         float end,
41         Unit previous,
42         Unit next,
43         int index) {
44
45         this.unitType = unitType;
46         this.unitNum = unitNum;
47         this.filename = filename;
48         this.start = start;
49         this.middle = middle;
50         this.end = end;
51         this.previous = previous;
52         this.next = next;
53         this.index = index;
54     }
55
56     public String toString() {
57         StringBuffer buf = new StringBuffer(filename + " ");
58         if (previous != null) {
59             buf.append(previous.unitType + "_" + previous.unitNum + " ");
60         } else {
61             buf.append("CLUNIT_NONE ");
62         }
63         buf.append(unitType + "_" + unitNum);
64         if (next != null) {
65             buf.append(" " + next.unitType + "_" + next.unitNum);
66         } else {
67             buf.append(" CLUNIT_NONE");
68         }
69         buf.append(" (index=" + index + ")");
70         
71         return buf.toString();
72     }
73 }