public class Duration
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
private class |
Duration.Time |
Modifier and Type | Field and Description |
---|---|
(package private) static long |
HOUR |
private long |
milliseconds |
(package private) static long |
MINUTE |
(package private) static java.text.NumberFormat |
NUM_FORMAT |
(package private) static long |
SECOND |
private static long |
serialVersionUID |
Constructor and Description |
---|
Duration()
Creates a new Duration object with 0 length.
|
Duration(int hours,
int minutes,
float seconds)
Creates a new duration object with the given hours, minutes and seconds
|
Duration(long milliseconds)
Creates a new instance of Duration specifying a length in milliseconds
|
Duration(java.lang.String duration)
Creates a new Duration parsing the String value.
|
Modifier and Type | Method and Description |
---|---|
long |
getMilliseconds()
Returns the millisecond length
|
void |
setMilliseconds(long milliseconds)
Sets the millisecond length
|
java.lang.String |
toString()
Returns a String representation in the formation HH:MM:SS
|
private static final long serialVersionUID
static final long SECOND
static final long MINUTE
static final long HOUR
static final java.text.NumberFormat NUM_FORMAT
private long milliseconds
public Duration()
public Duration(long milliseconds)
milliseconds
- Creates a new instance of Duration specifying a length in millisecondspublic Duration(int hours, int minutes, float seconds)
hours
- number of hoursminutes
- number of minutesseconds
- number of secondspublic Duration(java.lang.String duration)
duration
- A String to parsepublic java.lang.String toString()
toString
in class java.lang.Object
public long getMilliseconds()
public void setMilliseconds(long milliseconds)
milliseconds
- the millisecond length