Fixed fileParser in order to read time scale in decimal

- json-simple can read either long or double. Updated getScaleTime to make it capable to read a decimal number.

#fix #story[5]
This commit is contained in:
Haoming Yin
2017-03-08 14:13:23 +13:00
parent 2adf39ee43
commit 0ab2e7881f
4 changed files with 10 additions and 9 deletions
+4 -3
View File
@@ -54,12 +54,13 @@ public class FileParser {
* negative number, or containing non numeric character) or cannot be found.
*/
@SuppressWarnings("unchecked")
public long getTimeScale() {
public double getTimeScale() {
try {
long timeScale = (long) this.content.get("time-scale");
double timeScale = (double) this.content.get("time-scale");
return timeScale >= 0 ? timeScale : -1;
} catch (Exception e) {
return -1;
e.printStackTrace();
return 1;
}
}