public class TimeFrame extends Object
This object wraps around a BigDecimal that represents the number of milliseconds it takes to pass through the period.
Modifier and Type | Field and Description |
---|---|
static int |
DAYS
Formatting enum.
|
static int |
HOURS
Formatting enum.
|
static int |
MINUTES
Formatting enum.
|
static int |
WEEKS
Formatting enum.
|
Constructor and Description |
---|
TimeFrame(BigDecimal period)
Constructs the TimeFrame for the given time.
|
Modifier and Type | Method and Description |
---|---|
Date |
addToDate(Date date)
Returns a Date that is the addition of this period of time to the given
date.
|
boolean |
equals(Object ob)
Returns true if the TimeFrame is equal to another.
|
String |
format(int format_type)
Returns a string that represents this time frame formatted as a string.
|
String |
format(int format_type,
boolean shorthand)
Returns a string that represents this time frame formatted as a string.
|
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(String str)
Parses the given String and returns a TimeFrame object that represents
the date.
|
String |
toString()
For Debugging.
|
public static int WEEKS
public static int DAYS
public static int HOURS
public static int MINUTES
public TimeFrame(BigDecimal period)
public BigDecimal getPeriod()
public boolean isNoTime()
public Date addToDate(Date date)
public String format(int format_type)
format_type
- either WEEKS, HOURS, MINUTESpublic 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(String str) throws ParseException
"3 wks 12 days", "5.4 days", "9d", "12 minutes", "24 mins", etc.
See 'GeneralParser' for more details.
ParseException
public boolean equals(Object ob)
Copyright © 2015. All rights reserved.