public class MTimeInterval extends Object
MTimeInterval class.
| Modifier and Type | Field and Description |
|---|---|
static int |
DAY
Constant
DAY=5 |
static long |
DAY_IN_MILLISECOUNDS
Constant
DAY_IN_MILLISECOUNDS=HOUR_IN_MILLISECOUNDS * 24 |
static int |
HOUR
Constant
HOUR=4 |
static long |
HOUR_IN_MILLISECOUNDS
Constant
HOUR_IN_MILLISECOUNDS=MINUTE_IN_MILLISECOUNDS * 60 |
static int |
MILLISECOND
Constant
MILLISECOND=1 |
static int |
MINUTE
Constant
MINUTE=3 |
static long |
MINUTE_IN_MILLISECOUNDS
Constant
MINUTE_IN_MILLISECOUNDS=SECOUND_IN_MILLISECOUNDS * 60 |
static int |
SECOND
Constant
SECOND=2 |
static long |
SECOUND_IN_MILLISECOUNDS
Constant
SECOUND_IN_MILLISECOUNDS=1000 |
static int |
WEEK
Constant
WEEK=6 |
static long |
WEEK_IN_MILLISECOUNDS
Constant
WEEK_IN_MILLISECOUNDS=DAY_IN_MILLISECOUNDS * 7 |
| Constructor and Description |
|---|
MTimeInterval()
Constructor for MTimeInterval.
|
MTimeInterval(String _interval)
Constructor for MTimeInterval.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int _type,
long _value)
add.
|
void |
add(MTimeInterval interval)
add.
|
long |
getAllDays()
getAllDays.
|
long |
getAllMilliseconds()
getAllMilliseconds.
|
long |
getAllMinutes()
getAllMinutes.
|
long |
getAllSecounds()
getAllSecounds.
|
long |
getAllWeeks()
getAllWeeks.
|
int |
getDays()
Getter for the field
days. |
int |
getHours()
Getter for the field
hours. |
int |
getMilliseconds()
getMilliseconds.
|
int |
getMinutes()
Getter for the field
minutes. |
int |
getSeconds()
Getter for the field
seconds. |
int |
getWeeks()
Getter for the field
weeks. |
static boolean |
isTimeOut(long start,
long timeout)
isTimeOut.
|
static boolean |
isTimeOut(long start,
long stop,
long timeout)
isTimeOut.
|
void |
join(Calendar _cal)
join.
|
Date |
join(Date _date)
join.
|
void |
optimize()
optimize.
|
void |
parse(String _interval)
parse.
|
static long |
toMilliseconds(String interval,
int def)
Parse a string and returns an interval, possible formats are
Secounds: 123425
Secounds and millis: 12345.123
Format: Day Hour:Minutes:Secounds.Millis or DD HH:MM:ss.SSS
or ss, ss.SSS, MM:ss.SSS, HH:MM:ss.SSS, MM:ss, HH:MM:ss
|
String |
toString() |
static long |
toTime(String in,
long def)
toTime.
|
public static final long SECOUND_IN_MILLISECOUNDS
SECOUND_IN_MILLISECOUNDS=1000public static final long MINUTE_IN_MILLISECOUNDS
MINUTE_IN_MILLISECOUNDS=SECOUND_IN_MILLISECOUNDS * 60public static final long HOUR_IN_MILLISECOUNDS
HOUR_IN_MILLISECOUNDS=MINUTE_IN_MILLISECOUNDS * 60public static final long DAY_IN_MILLISECOUNDS
DAY_IN_MILLISECOUNDS=HOUR_IN_MILLISECOUNDS * 24public static final long WEEK_IN_MILLISECOUNDS
WEEK_IN_MILLISECOUNDS=DAY_IN_MILLISECOUNDS * 7public static final int MILLISECOND
MILLISECOND=1public static final int SECOND
SECOND=2public static final int MINUTE
MINUTE=3public static final int HOUR
HOUR=4public static final int DAY
DAY=5public static final int WEEK
WEEK=6public MTimeInterval()
Constructor for MTimeInterval.
public MTimeInterval(String _interval) throws NumberFormatException
Constructor for MTimeInterval.
_interval - a String object.NumberFormatException - if any.public void parse(String _interval) throws NumberFormatException
parse.
_interval - a String object.NumberFormatException - if any.public void add(MTimeInterval interval)
add.
interval - a MTimeInterval object.public void add(int _type,
long _value)
add.
_type - a int._value - a long.public void optimize()
optimize.
public static long toMilliseconds(String interval, int def)
interval - a String object.def - a int.public int getMilliseconds()
getMilliseconds.
public int getSeconds()
Getter for the field seconds.
public int getMinutes()
Getter for the field minutes.
public int getHours()
Getter for the field hours.
public int getDays()
Getter for the field days.
public int getWeeks()
Getter for the field weeks.
public long getAllMilliseconds()
getAllMilliseconds.
public long getAllSecounds()
getAllSecounds.
public long getAllMinutes()
getAllMinutes.
public long getAllDays()
getAllDays.
public long getAllWeeks()
getAllWeeks.
public static boolean isTimeOut(long start,
long stop,
long timeout)
isTimeOut.
start - a long.stop - a long.timeout - a long.public static boolean isTimeOut(long start,
long timeout)
isTimeOut.
start - a long.timeout - a long.Copyright © 2016. All Rights Reserved.