|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.gantt.graphic.IlvLinearTimeConverter
public class IlvLinearTimeConverter
A linear time converter.
An IlvLinearTimeConverter is capable of converting
a Date to a double value, and a
double value to a Date in a linear way.
The converter is defined by a reference time and a unit duration. The reference time represents the time where the double value is 0, and the unit duration is the duration of a double value of 1.
Here is the conversion formula:
double value = ( time value - reference time ) / unit duration
It is strongly recommended that the reference time should be evenly divisible by the
unit duration. In other words, getReferenceTime().getTime() % getUnitDuration().getMillis() = 0.
This ensures the highest level of precision during the conversion calculations.
| Constructor Summary | |
|---|---|
IlvLinearTimeConverter()
Creates an IlvLinearTimeConverter with a default
unit duration of one hour. |
|
IlvLinearTimeConverter(Date refTime,
IlvDuration unit)
Creates a linear time converter. |
|
| Method Summary | |
|---|---|
Date |
getReferenceTime()
Returns the reference time. |
Date |
getTime(double units)
Converts a double value to a Date. |
IlvDuration |
getUnitDuration()
Returns the unit duration. |
double |
getUnits(Date time)
Converts a Date to a double. |
boolean |
isLinear()
Returns whether the time converter is continuous and linear. |
void |
setReferenceTime(Date time)
Sets the reference time. |
void |
setUnitDuration(IlvDuration unit)
Sets the unit duration. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlvLinearTimeConverter(Date refTime,
IlvDuration unit)
refTime - Gives the reference time for the new converter.
It is strongly recommended that the reference time should be evenly
divisible by the unit duration. In other words,
refTime.getTime() % unit.getMillis() = 0.unit - Defines the unit time used for the conversion. The value
provided should not be 0.public IlvLinearTimeConverter()
IlvLinearTimeConverter with a default
unit duration of one hour.
| Method Detail |
|---|
public double getUnits(Date time)
Date to a double.
getUnits in interface IlvTimeConvertertime - The Date to be converted.
public Date getTime(double units)
Date.
getTime in interface IlvTimeConverterunits - The double value to be converted.
public Date getReferenceTime()
setReferenceTime(java.util.Date)public void setReferenceTime(Date time)
time - The new reference time
It is strongly recommended that the reference time should be evenly
divisible by the unit duration. In other words,
time.getTime() % getUnitDuration().getMillis() = 0.getReferenceTime()public IlvDuration getUnitDuration()
setUnitDuration(ilog.views.gantt.IlvDuration)public void setUnitDuration(IlvDuration unit)
unit - The new unit duration.
It is strongly recommended that the reference time should be evenly
divisible by the unit duration. In other words,
getReferenceTime().getTime() % unit.getMillis() = 0.
The value provided must not be 0.getUnitDuration()public boolean isLinear()
true.
isLinear in interface IlvTimeConverter
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||