diff --git a/src/main/java/org/m2ci/msp/jtgt/TextGrid.java b/src/main/java/org/m2ci/msp/jtgt/TextGrid.java index e9427e4..0d76c95 100644 --- a/src/main/java/org/m2ci/msp/jtgt/TextGrid.java +++ b/src/main/java/org/m2ci/msp/jtgt/TextGrid.java @@ -22,6 +22,7 @@ public class TextGrid { private double _end; /** The filename associated with the textgrid */ + @Deprecated private String _filename; /********************************************************************************************* @@ -55,7 +56,9 @@ public TextGrid(String filename) { * @param filename the filename * @param start the start time of the textgrid * @param end the end time of the textgrid + * @deprecated use {@link #TextGrid(double, double)} */ + @Deprecated public TextGrid(String filename, double start, double end) { setFilename(filename); setStart(start); @@ -63,6 +66,18 @@ public TextGrid(String filename, double start, double end) { setTiers(new ArrayList()); } + /** + * Constructor with full information without the tiers + * + * @param start the start time of the textgrid + * @param end the end time of the textgrid + */ + public TextGrid(double start, double end) { + setStart(start); + setEnd(end); + setTiers(new ArrayList()); + } + /** * Constructor with full informations with the tiers * @@ -70,7 +85,9 @@ public TextGrid(String filename, double start, double end) { * @param start the start time of the textgrid * @param end the end time of the textgrid * @param tiers the tiers which are going to compose the textgrid + * @deprecated use {@link #TextGrid(double, double, ArrayList)} */ + @Deprecated public TextGrid(String filename, double start, double end, ArrayList tiers) { setFilename(filename); setStart(start); @@ -78,6 +95,19 @@ public TextGrid(String filename, double start, double end, ArrayList tiers setTiers(tiers); } + /** + * Constructor with full information with the tiers + * + * @param start the start time of the textgrid + * @param end the end time of the textgrid + * @param tiers the tiers which are going to comprise the textgrid + */ + public TextGrid(double start, double end, ArrayList tiers) { + setStart(start); + setEnd(end); + setTiers(tiers); + } + /********************************************************************************************* ** Accessors *********************************************************************************************/ @@ -94,7 +124,9 @@ public ArrayList getTiers() { * Getting the filename * * @return the filename + * @deprecated TextGrids should not have a filename */ + @Deprecated public String getFilename() { return _filename; } @@ -130,7 +162,9 @@ public void setTiers(ArrayList tiers) { * Define the filename * * @param filename the filename associated to the textgrid + * @deprecated TextGrids should not have a filename */ + @Deprecated public void setFilename(String filename) { this._filename = filename; } diff --git a/src/main/java/org/m2ci/msp/jtgt/io/TextGridSerializer.java b/src/main/java/org/m2ci/msp/jtgt/io/TextGridSerializer.java index 2c09470..902252f 100644 --- a/src/main/java/org/m2ci/msp/jtgt/io/TextGridSerializer.java +++ b/src/main/java/org/m2ci/msp/jtgt/io/TextGridSerializer.java @@ -117,7 +117,7 @@ public TextGrid fromString(String str_tgt) throws TextGridIOException { ") and the expected number of tiers (" + nb_tiers + ")"); } - tgt = new TextGrid(null, xmin, xmax, tiers); + tgt = new TextGrid(xmin, xmax, tiers); } else { throw new TextGridIOException("Short format not supported yet or invalid line: \"" + lines.get(0) + "\"");