org.ka2ddo.yaac.ax25
Class Age

java.lang.Object
  extended by org.ka2ddo.yaac.ax25.Age
All Implemented Interfaces:
java.lang.Comparable<Age>

public class Age
extends java.lang.Object
implements java.lang.Comparable<Age>

This class represents a message parameter (in milliseconds) in a form that can be rendered easily on a GUI widget.


Field Summary
static long HALF_HOUR_IN_MSEC
          Convenience constant for the number of milliseconds in a half hour.
 
Constructor Summary
Age(long millisecondsOfAge)
          Create an Age object with the specified number of milliseconds in its age.
 
Method Summary
 int compareTo(Age o)
          Test if this Age is older than another Age.
static Age[] createAgeArray(long startInterval, long maxDelta)
          Create an array of Age objects covering the specified span of time in human-like spacings.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 long getAge()
          Get the delta time of this Age in milliseconds.
 int hashCode()
          Returns a hash code value for the object.
 java.lang.String toString()
          Display a human-friendly representation of this Age's time interval.
 java.lang.String toString(boolean showBackwardsTime)
          Display a human-friendly representation of this Age's time interval.
static java.lang.String toString(long age)
          Display a delta time (in milliseconds) in a human friendly String.
static java.lang.String toString(long age, boolean showBackwardsTime)
          Display a delta time (in milliseconds) in a human friendly String.
static java.lang.String toString(long age, boolean showBackwardsTime, boolean spellOutUnits)
          Display a delta time (in milliseconds) in a human friendly String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HALF_HOUR_IN_MSEC

public static final long HALF_HOUR_IN_MSEC
Convenience constant for the number of milliseconds in a half hour.

See Also:
Constant Field Values
Constructor Detail

Age

public Age(long millisecondsOfAge)
Create an Age object with the specified number of milliseconds in its age.

Parameters:
millisecondsOfAge - milliseconds of age
Method Detail

createAgeArray

public static Age[] createAgeArray(long startInterval,
                                   long maxDelta)
Create an array of Age objects covering the specified span of time in human-like spacings.

Parameters:
startInterval - the smallest time interval in milliseconds
maxDelta - the largest time interval in milliseconds
Returns:
Age array of intervals in the requested span

toString

public java.lang.String toString()
Display a human-friendly representation of this Age's time interval.

Overrides:
toString in class java.lang.Object
Returns:
the Age in days, hours, minutes, and seconds.

toString

public java.lang.String toString(boolean showBackwardsTime)
Display a human-friendly representation of this Age's time interval.

Parameters:
showBackwardsTime - if boolean true and age is negative, show it as absolute, otherwise report "???"
Returns:
the Age in days, hours, minutes, and seconds.

toString

public static java.lang.String toString(long age)
Display a delta time (in milliseconds) in a human friendly String.

Parameters:
age - the delta time in milliseconds
Returns:
the age in days, hours, minutes, and seconds.

toString

public static java.lang.String toString(long age,
                                        boolean showBackwardsTime)
Display a delta time (in milliseconds) in a human friendly String.

Parameters:
age - the delta time in milliseconds
showBackwardsTime - if boolean true and age is negative, show it as absolute, otherwise report "???"
Returns:
the age in days, hours, minutes, and seconds.

toString

public static java.lang.String toString(long age,
                                        boolean showBackwardsTime,
                                        boolean spellOutUnits)
Display a delta time (in milliseconds) in a human friendly String.

Parameters:
age - the delta time in milliseconds
showBackwardsTime - if boolean true and age is negative, show it as absolute, otherwise report "???"
spellOutUnits - boolean true if spelled-out localized words for time units should be used instead of single English-unit letters
Returns:
the age in days, hours, minutes, and seconds.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
hashCode(), Hashtable

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.
See Also:
Object.equals(Object), Hashtable

compareTo

public int compareTo(Age o)
Test if this Age is older than another Age. Note that "permanent" Ages are older than non-permanent ages.

Specified by:
compareTo in interface java.lang.Comparable<Age>
Parameters:
o - other Age object to compare to this one
Returns:
-1 if this Age is older than the other Age, 0 if their ages are the same, or +1 if this Age is newer than the other Age

getAge

public long getAge()
Get the delta time of this Age in milliseconds.

Returns:
millisecond delta time of this Age