|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mckoi.util.TimeFrame
public class TimeFrame
An immutable object that represents a frame of time down to the accuracy of a millisecond.
This object wraps around a BigDecimal that represents the number of milliseconds it takes to pass through the period.
Field Summary | |
---|---|
static int |
DAYS
Formatting enum. |
static int |
HOURS
Formatting enum. |
static int |
MINUTES
Formatting enum. |
static int |
WEEKS
Formatting enum. |
Constructor Summary | |
---|---|
TimeFrame(java.math.BigDecimal period)
Constructs the TimeFrame for the given time. |
Method Summary | |
---|---|
java.util.Date |
addToDate(java.util.Date date)
Returns a Date that is the addition of this period of time to the given date. |
boolean |
equals(java.lang.Object ob)
Returns true if the TimeFrame is equal to another. |
java.lang.String |
format(int format_type)
Returns a string that represents this time frame formatted as a string. |
java.lang.String |
format(int format_type,
boolean shorthand)
Returns a string that represents this time frame formatted as a string. |
java.math.BigDecimal |
getPeriod()
Returns the number of milliseconds for the period of this time frame. |
boolean |
isNoTime()
Returns true if this time frame represents no time. |
static TimeFrame |
parse(java.lang.String str)
Parses the given String and returns a TimeFrame object that represents the date. |
java.lang.String |
toString()
For Debugging. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int WEEKS
public static int DAYS
public static int HOURS
public static int MINUTES
Constructor Detail |
---|
public TimeFrame(java.math.BigDecimal period)
Method Detail |
---|
public java.math.BigDecimal getPeriod()
public boolean isNoTime()
public java.util.Date addToDate(java.util.Date date)
public java.lang.String format(int format_type)
format_type
- either WEEKS, HOURS, MINUTESpublic java.lang.String format(int format_type, boolean shorthand)
format_type
- either WEEKS, HOURS, MINUTESshorthand
- if false then timeframe is formatted in long hand.
'ms' -> 'milliseconds'public static TimeFrame parse(java.lang.String str) throws java.text.ParseException
"3 wks 12 days", "5.4 days", "9d", "12 minutes", "24 mins", etc.
See 'GeneralParser' for more details.
java.text.ParseException
public boolean equals(java.lang.Object ob)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |