|
ALBPM Process API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfuego.lang.Interval
public final class Interval
Space of time between any two points or events. The "Interval" class represents the time between two events in the time, as for example, the quantity of days in which a sale order will due (difference between 'now' and the order due date). The interval may be represented by a number of years, months, days, hours, minutes, seconds. It will depend on the possibility of expressing the interval in those units. As the interval is a quantity of time and it does not include a date sometimes it is not possible to express the years, months, days, etc. It stores time offsets, including time-of-day offsets. It makes no timezone correction, since it does not include a date. When an interval is created from the difference between two dates, something like:
d1, d2 as Time d1 = Time(1961, 1, 1) d2 = 'now' interval = d2 - d1 |
Nested Class Summary | |
---|---|
static class |
Interval.Holder
|
Field Summary | |
---|---|
static Interval |
ONE_DAY
A One day Inteval |
static Interval |
ONE_HOUR
A One hour Inteval |
static Interval |
ONE_MINUTE
A One minute Inteval |
static Interval |
ONE_MONTH
A One month Inteval |
static Interval |
ONE_SECOND
A One second Inteval |
static Interval |
ONE_WEEK
A One week Inteval |
static Interval |
ZERO
Zero Inteval |
Constructor Summary | |
---|---|
Interval()
|
Method Summary | |
---|---|
Interval |
abs()
Absolute value of this object. |
Interval |
add(Interval t)
Adds a new Interval. |
static Interval |
add(Interval op1,
Interval op2)
Adds two Intervals |
Time |
add(Time t)
Adds a interval to the Time specified as parameter. |
Interval |
addDays(int i)
Adds days to an interval. |
Interval |
addHours(long i)
Adds hours to an interval. |
Interval |
addMicroSeconds(long i)
Adds micro-seconds to this time |
Interval |
addMinutes(long i)
Adds minutes to this interval. |
Interval |
addMonths(int i)
Adds months to this interval. |
Interval |
addSeconds(long i)
Adds seconds to this time |
Interval |
addYears(int i)
Adds years to this time |
static int |
compare(Interval a,
Interval b)
Compares two Intervals. |
int |
compareTo(Object b)
Compares this object with another Interval. |
static Interval |
daysOnly(Interval i,
int day)
Only Sets the day value to the interval i |
static boolean |
equals(Interval a,
Interval b)
Compares Intervals |
boolean |
equals(Object b)
Compares this object with an object received as a parameter |
String |
format()
Formats the interval. |
String |
format(fuego.lang.IntervalUnit from,
fuego.lang.IntervalUnit to)
Formats the interval showing the interval units included in the from/to range. |
static Interval |
fromMinutes(int minutes)
Constructs an interval from a number of minutes |
static Interval |
fromSeconds(int seconds)
Constructs an interval from a number of seconds |
long |
get(fuego.lang.IntervalUnit field)
|
double |
getAproximateTotal(fuego.lang.IntervalUnit field)
|
int |
getDays()
The "days" value for this interval. |
int |
getDaysOnly()
The "days" value for this interval. |
static String |
getFieldName(fuego.lang.IntervalUnit field)
|
int |
getHours()
The "hours" value for this interval. |
int |
getHoursOnly()
The "hours" value for this interval. |
long |
getMicroSeconds()
Hour portion of the interval reexpressed into microseconds. |
int |
getMicroSecondsOnly()
The "microseconds" part of the interval. |
long |
getMilliSeconds()
Hour portion of the interval reexpressed into milliseconds. |
int |
getMilliSecondsOnly()
The "milliseconds" part of the interval. |
int |
getMinutes()
Hour portion of the interval reexpressed into minutes. |
int |
getMinutesOnly()
The "minutes" value of the interval. |
int |
getMonths()
The "years/months" value for this interval expressed in months. |
int |
getMonthsOnly()
The "months" value for this interval. |
long |
getOnly(fuego.lang.IntervalUnit field)
|
int |
getSeconds()
Hour portion of the interval reexpressed into seconds. |
int |
getSecondsOnly()
The "seconds" value for this interval. |
long |
getTotalMicroseconds()
|
int |
getYears()
The "years" value for this interval. |
int |
getYearsOnly()
The "years" value for this interval. |
int |
hashCode()
Returns hash code |
static Interval |
hoursOnly(Interval i,
int hour)
Sets only the hours value to an Interval object |
int |
intValue()
Number of seconds that the interval represents |
Interval |
max(Interval b)
Compares this object with the argument and returns the higher. |
static Interval |
microSecondsOnly(Interval i,
long microSecond)
Sets only microsecond value to an Interval object |
static Interval |
milliSecondsOnly(Interval i,
long milliSecond)
Sets only milliseconds value to an Interval object |
Interval |
min(Interval b)
Compares this object with the argument and returns the lower. |
static Interval |
minutesOnly(Interval i,
int minute)
Sets only the minute value to an Interval object |
static Interval |
monthsOnly(Interval i,
int month)
Sets only the month value to an Interval object |
Interval |
negate()
Returns a Interval whose value is (-this). |
static Interval |
negate(Interval op)
|
static Interval |
normalizedValueOf(long microSeconds)
|
String |
retryIn()
|
static Interval |
secondsOnly(Interval i,
int second)
|
Interval |
set(fuego.lang.IntervalUnit field,
long value)
|
Interval |
setOnly(fuego.lang.IntervalUnit field,
long value)
|
void |
sleep()
Causes the current execution to sleep for the milliseconds value of this object. |
Interval |
sub(Interval t)
Substracts an Interval. |
static Interval |
sub(Interval op1,
Interval op2)
Substracts two Intervals |
Time |
subFrom(Time t)
Substract from a Time. |
String |
toString()
Returns a string representation of a value |
String |
toXMLString()
Returns an XML string representation of an interval value |
static Interval |
valueOf(BigDecimal ms)
Constructor from a number of microseconds |
static Interval |
valueOf(double ms)
Constructor from a number of microseconds(from a double) |
static Interval |
valueOf(int months,
int days,
long microSeconds)
Constructor from a number of months and a number of microseconds |
static Interval |
valueOf(long microSeconds)
Constructor from a number of microseconds (from a long) |
static Interval |
valueOf(Number obj)
|
static Interval |
valueOf(Object obj)
Constructs an interval from another Object (eg: Interval, Time, Number or String) |
static Interval |
valueOf(String t)
Parses a string with one of the following formats: -? {tmspec}+ -? {num}:{num}(:{num}(.{num})?)? Where {tmspec} is one of: {num}{ws}*M --> months {num}{ws}*d --> days {num}{ws}*h --> hours {num}{ws}*m --> minutes {num}{ws}*s --> seconds {num}{ws}*x --> microseconds and {num} is a number with an optional decimal part For example: 1M10d2s --> 1 month, 10 days, 2 seconds 10 d 2.5 m --> 10 days, 2 minutes, 30 seconds 365.25d 10h 3s 3.5s --> 365 days, 16 hours, 6 seconds, 500000 microseconds 10 d 2.5 --> FormatException |
static Interval |
valueOf(Time i)
Constructs an interval from a Time object. |
static Interval |
valueOf(Time op1,
Time op2)
Returns the subtraction between two Times as an Interval object |
static Interval |
yearsOnly(Interval i,
int year)
Sets only the year value to an Interval object |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Interval ZERO
public static final Interval ONE_SECOND
public static final Interval ONE_MINUTE
public static final Interval ONE_HOUR
public static final Interval ONE_DAY
public static final Interval ONE_WEEK
public static final Interval ONE_MONTH
Constructor Detail |
---|
public Interval()
Method Detail |
---|
public static Interval add(Interval op1, Interval op2)
op1
- The first operandop2
- The second operand
public static int compare(Interval a, Interval b)
a
- Interval first Interval to be compared.b
- Interval second Interval to be compared.
public static Interval daysOnly(Interval i, int day)
i
- Interval The interval to be setday
- int Value of daypublic static boolean equals(Interval a, Interval b)
a
- an object to compare.b
- an object to compare.
public static Interval fromMinutes(int minutes)
minutes
- The number of minutes, can be negative.public static Interval fromSeconds(int seconds)
seconds
- The number of seconds, can be negative.public static String getFieldName(fuego.lang.IntervalUnit field)
public static Interval hoursOnly(Interval i, int hour)
i
- Interval The Interval objecthour
- int Hour value to be assigned.public static Interval microSecondsOnly(Interval i, long microSecond)
i
- Interval The Interval objectmicroSecond
- long Microsecond value to be assigned.public static Interval milliSecondsOnly(Interval i, long milliSecond)
i
- Interval The Interval objectmilliSecond
- long Milliseconds value to be assigned.public static Interval minutesOnly(Interval i, int minute)
i
- Interval The Interval objectminute
- int Minute value to be assigned.public static Interval monthsOnly(Interval i, int month)
i
- Interval The Interval objectmonth
- int Month value to be assigned.public static Interval negate(Interval op)
public static Interval secondsOnly(Interval i, int second)
public static Interval sub(Interval op1, Interval op2)
op1
- The first operandop2
- The second operand
public static Interval valueOf(Time i)
i
- Time The object .public static Interval valueOf(Object obj)
obj
- The object.public static Interval valueOf(Number obj)
public static Interval valueOf(@NonNls String t) throws fuego.lang.FormatException
t
- The string to parse
fuego.lang.IntervalFormatException
fuego.lang.FormatException
public static Interval valueOf(BigDecimal ms)
ms
- The number of microseconds, can be negative.public static Interval valueOf(double ms)
ms
- The number of microseconds, can be negative.public static Interval valueOf(long microSeconds)
microSeconds
- The number of microseconds, can be negative.public static Interval normalizedValueOf(long microSeconds)
public static Interval valueOf(Time op1, Time op2)
op1
- First Time object.op2
- Second Time object.public static Interval valueOf(int months, int days, long microSeconds)
months
- The number of months, can be negative.days
- The number of days, can be negative.microSeconds
- The number of microseconds, can be negative.public static Interval yearsOnly(Interval i, int year)
public Interval abs()
public Time add(Time t)
t
- The Time to add.public Interval add(Interval t)
t
- The interval to add.public Interval addDays(int i)
i
- Days to add (can be negative)public Interval addHours(long i)
i
- Hours to add (can be negative)public Interval addMicroSeconds(long i)
i
- Micro-seconds to add (can be negative)public Interval addMinutes(long i)
i
- Minutes to add (can be negative)public Interval addMonths(int i)
i
- Months to add (can be negative)public Interval addSeconds(long i)
i
- Seconds to add (can be negative)public Interval addYears(int i)
i
- Years to add (can be negative)public int compareTo(Object b)
0
if the argument is equal to
this object; a value less than 0
if this object
is less than the argument; and a
value greater than 0
otherwise.
compareTo
in interface Comparable
b
- the Interval
to be compared.public boolean equals(Object b)
equals
in class Object
b
- an object to compare to.
public String format()
public String format(fuego.lang.IntervalUnit from, fuego.lang.IntervalUnit to)
from
- IntervalUnit to format the interval fromto
- IntervalUnit to format the interval to
public long get(fuego.lang.IntervalUnit field)
public double getAproximateTotal(fuego.lang.IntervalUnit field)
public int getDays()
public int getDaysOnly()
public int getHours()
public int getHoursOnly()
public long getMicroSeconds()
public int getMicroSecondsOnly()
public long getMilliSeconds()
public int getMilliSecondsOnly()
public int getMinutes()
public int getMinutesOnly()
public int getMonths()
public int getMonthsOnly()
public long getOnly(fuego.lang.IntervalUnit field)
public int getSeconds()
public int getSecondsOnly()
public long getTotalMicroseconds()
public int getYears()
public int getYearsOnly()
public int hashCode()
hashCode
in class Object
public int intValue()
public Interval max(Interval b)
b
- Interval The argument to compare with this object
public Interval min(Interval b)
b
- Interval The argument to compare with this object
public Interval negate()
public String retryIn()
public Interval set(fuego.lang.IntervalUnit field, long value)
public Interval setOnly(fuego.lang.IntervalUnit field, long value)
public void sleep() throws InterruptedException
InterruptedException
public Interval sub(Interval t)
t
- The interval to be substracted.public Time subFrom(Time t)
t
- The Time to be substracted from.public String toString()
toString
in class Object
public String toXMLString()
|
ALBPM Process API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |