Modifier and Type | Field and Description |
---|---|
static long |
HALF_HOUR_IN_MSEC
Convenience constant for the number of milliseconds in a half hour.
|
Constructor and Description |
---|
Age(long millisecondsOfAge)
Create an Age object with the specified number of milliseconds in its age.
|
Age(java.lang.String val)
Create an Age object from a string in the format that Ages are presented in.
|
Modifier and Type | Method and Description |
---|---|
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.
|
static Age[] |
createAgeArray(long startInterval,
long maxDelta,
int padToString)
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 |
getPadToString()
Obtain the minimum number of characters to render an Age.
|
int |
hashCode()
Returns a hash code value for the object.
|
static long |
parseAge(java.lang.String val)
Parse an Age value from a String in the format that Ages are presented in.
|
void |
setPadToString(int padToString)
Set the minimum number of characters to render an Age.
|
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.
|
static java.lang.String |
toString(long age,
boolean showBackwardsTime,
boolean spellOutUnits,
int padToString)
Display a delta time (in milliseconds) in a human friendly String.
|
public static final long HALF_HOUR_IN_MSEC
public Age(long millisecondsOfAge)
millisecondsOfAge
- milliseconds of agepublic Age(java.lang.String val) throws java.lang.IllegalArgumentException
val
- String to parsejava.lang.IllegalArgumentException
- if val can't be parsedpublic static long parseAge(java.lang.String val)
val
- String to parsejava.lang.IllegalArgumentException
- if val can't be parsedpublic static Age[] createAgeArray(long startInterval, long maxDelta)
startInterval
- the smallest time interval in millisecondsmaxDelta
- the largest time interval in millisecondspublic static Age[] createAgeArray(long startInterval, long maxDelta, int padToString)
startInterval
- the smallest time interval in millisecondsmaxDelta
- the largest time interval in millisecondspadToString
- int minimum number of characters in string formattingpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean showBackwardsTime)
showBackwardsTime
- if boolean true and age is negative, show it as absolute, otherwise report "???"public static java.lang.String toString(long age)
age
- the delta time in millisecondspublic static java.lang.String toString(long age, boolean showBackwardsTime)
age
- the delta time in millisecondsshowBackwardsTime
- if boolean true and age is negative, show it as absolute, otherwise report "???"public static java.lang.String toString(long age, boolean showBackwardsTime, boolean spellOutUnits)
age
- the delta time in millisecondsshowBackwardsTime
- 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 letterspublic static java.lang.String toString(long age, boolean showBackwardsTime, boolean spellOutUnits, int padToString)
age
- the delta time in millisecondsshowBackwardsTime
- 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 letterspadToString
- int minimum number of characters in formatted agepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.hashCode()
,
Hashtable
public int hashCode()
java.util.Hashtable
.hashCode
in class java.lang.Object
Object.equals(Object)
,
Hashtable
public int compareTo(Age o)
compareTo
in interface java.lang.Comparable<Age>
o
- other Age object to compare to this onepublic long getAge()
public int getPadToString()
public void setPadToString(int padToString)
padToString
- int minimum character count