public class TimeFrame
extends java.lang.Object
This object wraps around a BigDecimal that represents the number of milliseconds it takes to pass through the period.
Modifier and Type | Field | Description |
---|---|---|
static int |
DAYS |
Formatting enum.
|
static int |
HOURS |
Formatting enum.
|
static int |
MINUTES |
Formatting enum.
|
static int |
WEEKS |
Formatting enum.
|
Constructor | Description |
---|---|
TimeFrame(java.math.BigDecimal period) |
Constructs the TimeFrame for the given time.
|
Modifier and Type | Method | Description |
---|---|---|
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.
|
public static int WEEKS
public static int DAYS
public static int HOURS
public static int MINUTES
public TimeFrame(java.math.BigDecimal period)
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
Copyright © 2018. All rights reserved.