Skip to content

Commit

Permalink
Merge pull request #18 from psibre/deprecate-textgrid-filename
Browse files Browse the repository at this point in the history
deprecate TextGrid filename
  • Loading branch information
psibre authored Jun 20, 2018
2 parents 7496ee1 + 133dc35 commit 6e06d8b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions src/main/java/org/m2ci/msp/jtgt/TextGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class TextGrid {
private double _end;

/** The filename associated with the textgrid */
@Deprecated
private String _filename;

/*********************************************************************************************
Expand Down Expand Up @@ -55,29 +56,58 @@ 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);
setEnd(end);
setTiers(new ArrayList<Tier>());
}

/**
* 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<Tier>());
}

/**
* Constructor with full informations with the tiers
*
* @param filename the filename
* @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<Tier> tiers) {
setFilename(filename);
setStart(start);
setEnd(end);
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<Tier> tiers) {
setStart(start);
setEnd(end);
setTiers(tiers);
}

/*********************************************************************************************
** Accessors
*********************************************************************************************/
Expand All @@ -94,7 +124,9 @@ public ArrayList<Tier> getTiers() {
* Getting the filename
*
* @return the filename
* @deprecated TextGrids should not have a filename
*/
@Deprecated
public String getFilename() {
return _filename;
}
Expand Down Expand Up @@ -130,7 +162,9 @@ public void setTiers(ArrayList<Tier> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/m2ci/msp/jtgt/io/TextGridSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) + "\"");
Expand Down

0 comments on commit 6e06d8b

Please sign in to comment.