Modifier and Type | Field and Description |
---|---|
private int |
hour
Hour part
|
private static long |
LAST_MEASURE
Last measured time
|
private int |
microsecond
Microsecond part
|
private long |
microseconds
Total of microseconds
|
private int |
millisecond
Millisecond part
|
private int |
minute
minute
|
private int |
second
Second part
|
Constructor and Description |
---|
LapsTime()
Constructs LapsTime
|
LapsTime(int microsecond)
Constructs LapsTime
|
LapsTime(int millisecond,
int microsecond)
Constructs LapsTime
|
LapsTime(int second,
int millisecond,
int microsecond)
Constructs LapsTime
|
LapsTime(int minute,
int second,
int millisecond,
int microsecond)
Constructs LapsTime
|
LapsTime(int hour,
int minute,
int second,
int millisecond,
int microsecond)
Constructs LapsTime
|
LapsTime(long microseconds)
Constructs LapsTime
|
Modifier and Type | Method and Description |
---|---|
static LapsTime |
addition(LapsTime lapsTime1,
LapsTime lapsTime2,
LapsTime result)
Add two laps time.
|
int |
compareTo(LapsTime lapsTime)
Compare with an other laps time
|
static LapsTime |
divide(LapsTime lapsTime,
int factor,
LapsTime result)
Divide by a factor.
|
static LapsTime |
endMeasure()
End measure
|
boolean |
equals(java.lang.Object obj)
Indicates if an object is same as this laps time
|
int |
getHour()
Return hour
|
int |
getMicrosecond()
Return microsecond
|
int |
getMillisecond()
Return millisecond
|
int |
getMinute()
Return minute
|
int |
getSecond()
Return second
|
int |
hashCode()
Hash code
|
long |
inMicroseconds()
Total of microseconds
|
long |
inMilliseconds()
Total of milliseconds
|
static LapsTime |
multiply(LapsTime lapsTime,
int factor,
LapsTime result)
Multiply by a factor.
|
void |
setHour(int hour)
Modify hour
|
void |
setMicrosecond(int microsecond)
Modify microsecond
|
void |
setMillisecond(int millisecond)
Modify millisecond
|
void |
setMinute(int minute)
Modify minute
|
void |
setSecond(int second)
Modify second
|
static void |
startMeasure()
Start measure
|
static LapsTime |
substract(LapsTime lapsTime1,
LapsTime lapsTime2,
LapsTime result)
Subtract two laps time.
|
java.lang.String |
toString()
String representation
|
private void |
update()
Compute each part with total microseconds
|
private void |
updateMicroSeconds()
Compute total microseconds with each parts
|
private static long LAST_MEASURE
private int hour
private int microsecond
private long microseconds
private int millisecond
private int minute
private int second
public LapsTime()
public LapsTime(int microsecond)
microsecond
- Microsecond partpublic LapsTime(int millisecond, int microsecond)
millisecond
- Millisecond partmicrosecond
- Microsecond partpublic LapsTime(int second, int millisecond, int microsecond)
second
- Second partmillisecond
- Millisecond partmicrosecond
- Microsecond partpublic LapsTime(int minute, int second, int millisecond, int microsecond)
minute
- Minute partsecond
- Second partmillisecond
- Millisecond partmicrosecond
- Microsecond partpublic LapsTime(int hour, int minute, int second, int millisecond, int microsecond)
hour
- Hour partminute
- Minute partsecond
- Second partmillisecond
- Millisecond partmicrosecond
- Microsecond partpublic LapsTime(long microseconds)
microseconds
- Total of microsecondpublic static LapsTime addition(LapsTime lapsTime1, LapsTime lapsTime2, LapsTime result)
lapsTime1
and/or lapsTime2
and/or
result
lapsTime1
- First laps timelapsTime2
- Second laps timeresult
- For collect result. If null
, it create a new instancepublic static LapsTime divide(LapsTime lapsTime, int factor, LapsTime result)
lapsTime
and result
lapsTime
- Laps time to dividefactor
- Division factorresult
- For collect result. If null
, it create a new instancepublic static LapsTime endMeasure()
startMeasure()
public static LapsTime multiply(LapsTime lapsTime, int factor, LapsTime result)
lapsTime
and result
lapsTime
- Laps time to dividefactor
- Multiplication factorresult
- For collect result. If null
, it create a new instancepublic static void startMeasure()
public static LapsTime substract(LapsTime lapsTime1, LapsTime lapsTime2, LapsTime result)
lapsTime1
and/or lapsTime2
and/or
result
lapsTime1
- First laps timelapsTime2
- Second laps timeresult
- For collect result. If null
, it create a new instanceprivate void update()
private void updateMicroSeconds()
public int compareTo(LapsTime lapsTime)
compareTo
in interface java.lang.Comparable<LapsTime>
lapsTime
- Laps time to compare withComparable.compareTo(java.lang.Object)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object to comparetrue
if the sameObject.equals(java.lang.Object)
public int getHour()
public int getMicrosecond()
public int getMillisecond()
public int getMinute()
public int getSecond()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public long inMicroseconds()
public long inMilliseconds()
public void setHour(int hour)
hour
- New hour valuepublic void setMicrosecond(int microsecond)
microsecond
- New microsecond valuepublic void setMillisecond(int millisecond)
millisecond
- New millisecond valuepublic void setMinute(int minute)
minute
- New minute valuepublic void setSecond(int second)
second
- New second valuepublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()