|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfaa.tg.units.AMeasure
faa.tg.units.Time
public class Time
Time represents the object for measuring units of Time.See section 5.6 of the Detailed Design Document for a discussion of design issues.
See the source: Time.java
AUnits,
AMeasure,
Serialized Form| Field Summary | |
|---|---|
static java.lang.String |
CVS_VERSION_ID
The CVS Version ID. |
static Time |
MAX
|
static Time |
MIN_1
|
static Time |
MIN_10
|
static Time |
MIN_5
|
static Time |
MS_1
|
static Time |
ONE_MILLISEC
|
static Time |
ONE_MIN
|
static Time |
ONE_SEC
|
static Time |
SEC_1
|
static Time |
SEC_10
|
static Time |
SEC_20
|
static Time |
SEC_5
|
(package private) static long |
serialVersionUID
|
static java.text.SimpleDateFormat |
SORT_DATE_FMT
DateFormat for parsing or writing as: "yyyy/MM/dd_HH:mm:ss". |
static java.text.SimpleDateFormat |
STD_DATE_FMT
DateFormat for parsing or writing as: "MMM dd, yyyy HH:mm:ss z". |
static Time |
TEN_MIN
|
static Time |
ZERO
|
| Fields inherited from class faa.tg.units.AMeasure |
|---|
DEC0, DEC0_, DEC00, DEC000, DEC1, DEC1_, DEC12, DEC12_, DEC1L, DEC1L_, DEC2, DEC2_, DEC3, DEC3_, DEC4, DEC4_, DEC5, DEC5_, DEC6, DEC6_, DEC7, DEC7_, DEC9, DEC9_, itsValue, TIME_FRACTION |
| Constructor Summary | |
|---|---|
Time(double value,
TimeUnits units)
Constructor for the Time class. |
|
Time(java.lang.String timeString)
Constructor for a measure of time. |
|
| Method Summary | |
|---|---|
Time |
abs()
This method returns a clone that is the absolute value of this object. |
Time |
add(Time addend)
This summation method adds a value with like units. |
double |
as(TimeUnits theUnits)
The as method extracts the value from a Measure in specified units. |
boolean |
eq(Time theMeasure)
This method provides a test for equality. |
boolean |
ge(Time theMeasure)
This method provides a test for less than / equal to. |
boolean |
gt(Time theMeasure)
This method provides a test for greater than. |
static double |
hms2sec(java.lang.String timeString)
Converts the input String in "HH:MM:SS[.SSS]" to a double containing the time in seconds since 00:00:00. |
boolean |
le(Time theMeasure)
This method provides a test for greater than / equal to. |
boolean |
lt(Time theMeasure)
This method provides a test for less than. |
static void |
main(java.lang.String[] args)
Main is used for testing only. |
static Time |
now()
|
static double |
parseSeconds(java.lang.String timeString)
Converts the input String in "[[H:]MM:]SS[.SSS]" format to a double containing the time in seconds since 00:00:00. |
static Time |
parseTime(java.lang.String timeStr)
Creates a Time object from a String in a variety of input formats. |
double |
ratio(Time val)
This division method produces a dimensionless ratio of like measures. |
Time |
sub(Time subtrahend)
This subtraction method subtracts a value with like units. |
static Time |
timeElapsedSince(Time start)
This method will give you the difference between the start time and now. |
java.lang.String |
toHhmmString()
Returns the string representation of this object in the form HHMM (with seconds truncated) which is a NAS representation. |
java.lang.String |
toHmsString()
Returns the string representation of this object in the form HH:MM:SS[.SSS] which will display up to thousandths of a second if the time is not a round number. |
java.lang.String |
toHmsStringInt()
Returns the string representation of this object in the form HH:MM:SS. |
java.lang.String |
toString()
returns a String representation of this object. |
java.lang.String |
toText()
Returns the default string representation: "HH:MM:SS[.SSS]". |
| Methods inherited from class faa.tg.units.AMeasure |
|---|
absoluteValue, add, as, as, clone, compareTo, debug, div, eq, equals, ge, getAUnit, getCanonicalUnit, getCanonicalValue, getInitialUnit, getUnitClass, gt, hashCode, isBetween, le, lt, mul, ratio, sub, toAMeasure, toString, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final long serialVersionUID
public static final java.lang.String CVS_VERSION_ID
public static final Time ZERO
public static final Time MS_1
public static final Time SEC_1
public static final Time SEC_5
public static final Time SEC_10
public static final Time SEC_20
public static final Time MIN_1
public static final Time MIN_5
public static final Time MIN_10
public static final Time ONE_MILLISEC
public static final Time ONE_SEC
public static final Time ONE_MIN
public static final Time TEN_MIN
public static final Time MAX
public static final java.text.SimpleDateFormat STD_DATE_FMT
public static final java.text.SimpleDateFormat SORT_DATE_FMT
| Constructor Detail |
|---|
public Time(double value,
TimeUnits units)
value - The magnitude of Time as a double.units - The units of the value that will be stored (ex: km).
public Time(java.lang.String timeString)
throws java.lang.NumberFormatException
timeString - Initial time as a String (seconds or HH:MM:SS).
java.lang.NumberFormatException - Not numeric and not in [[HH:]MM:]SS[.SSS].parseSeconds(String)| Method Detail |
|---|
public static double parseSeconds(java.lang.String timeString)
throws java.lang.NumberFormatException
timeString - The initial time as a String.
java.lang.NumberFormatException - Not numeric and not in [[HH:]MM:]SS[.SSS].
public static Time parseTime(java.lang.String timeStr)
throws java.lang.IllegalArgumentException
HH:MM:SS MM:SS
# unitName #unitName (for a TimeUnits field name from Units)
# s #s # (for # in seconds)
timeStr - Time string in the format "# unitName" or "#" or "#s".
java.lang.NumberFormatException - Number fails to parse after removing unit.
java.lang.IllegalArgumentException - Alphabetic unit found but not valid.public static double hms2sec(java.lang.String timeString)
timeString - The initial time in String format (HH:MM:SS[.S*]).
java.lang.NumberFormatException - String is not in HH:MM:SS format.public Time add(Time addend)
NOTE: this does not prevent different subclasses of Time from being added. The class of the value returned by the add() is the same as this class (the augend).
addend - The unit of measure to add to this measure.
public Time sub(Time subtrahend)
NOTE: this does not prevent different subclasses of Time from being subtracted. The class of the value returned by the add() is the same as this class (the minuend).
subtrahend - The unit of measure to subtract from this measure.
public static Time now()
public static Time timeElapsedSince(Time start)
start -
public Time abs()
public double ratio(Time val)
public boolean eq(Time theMeasure)
public boolean lt(Time theMeasure)
public boolean gt(Time theMeasure)
public boolean ge(Time theMeasure)
public boolean le(Time theMeasure)
public double as(TimeUnits theUnits)
theUnits - the units of the value that will be returned (ex: km)
public java.lang.String toHmsString()
public java.lang.String toHhmmString()
public java.lang.String toHmsStringInt()
public java.lang.String toString()
toString in class AMeasureAMeasurepublic java.lang.String toText()
toText in interface HasTextpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||