m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/model
diff options
context:
space:
mode:
authorMartin <marcin.j.chrzanowski@gmail.com>2019-11-23 16:18:49 +0100
committerGitHub <noreply@github.com>2019-11-23 16:18:49 +0100
commit22f6a3082d5e9698e3be4208ca68cd6724239fd0 (patch)
tree6dd78ad1333c18f3b1578b2958d9c7ef687a25c1 /src/main/java/pl/edu/mimuw/cloudatlas/model
parentd683a761b2710a252b0bfb1b3f0879a60247bb50 (diff)
Interpreter conversions (#26)
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/model/ValueDuration.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueDuration.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueDuration.java
index 7a74776..ad14a30 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueDuration.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueDuration.java
@@ -264,9 +264,9 @@ public class ValueDuration extends ValueSimple<Long> {
remainingUnits /= 24;
long days = remainingUnits;
- return (positive ? "+" : "-") + Long.toString(days) + " " + Long.toString(hours)
- + ":" + Long.toString(minutes) + ":" + Long.toString(seconds) + "." +
- Long.toString(milliseconds);
+ return (positive ? "+" : "-") + String.format("%d %02d:%02d:%02d.%03d",
+ days, hours, minutes, seconds, milliseconds
+ );
}
@Override
@@ -274,6 +274,8 @@ public class ValueDuration extends ValueSimple<Long> {
switch(type.getPrimaryType()) {
case STRING:
return getValue() == null? ValueString.NULL_STRING : new ValueString(makeString());
+ case INT:
+ return new ValueInt(getValue() == null? null : getValue());
case DURATION:
return this;
default: