Commit f2d7d2a1 authored by Lubomir Bulej's avatar Lubomir Bulej

Added a toString() method to the Duration class.

parent af182a1f
...@@ -8,6 +8,9 @@ import ch.usi.dag.util.function.Predicate; ...@@ -8,6 +8,9 @@ import ch.usi.dag.util.function.Predicate;
/** /**
* Represents a fixed time interval. The interval is expressed as an integral
* amount of a particular {@link TimeUnit}, and does not support the notion of
* date, even though it may express durations measured in days.
* *
* @author Lubomir Bulej * @author Lubomir Bulej
*/ */
...@@ -186,4 +189,13 @@ public final class Duration { ...@@ -186,4 +189,13 @@ public final class Duration {
return new Duration (amount, unit); return new Duration (amount, unit);
} }
/**
* Returns a string representation of this {@link Duration}.
*/
@Override
public String toString () {
return String.format ("Duration [%d %s]", __amount, __unit);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment