|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.virtualweaver.xotics.datamodel.datatype.XdtDuration
A class representing a duration, as used in XML Schema datatypes. This class is the Java type of [@link com.virtualweaver.xotics.datatype.XsdDuration} XSD implementation class. Notes that duration is signed (i.e negative duration run in the past).
Field Summary | |
static XdtDuration |
MAX_VALUE
The greatest value an XdtDuration can take. |
Constructor Summary | |
XdtDuration()
|
|
XdtDuration(int y,
int m,
int d,
int h,
int mn,
double sec,
boolean sign)
Create a duration giving each field. |
|
XdtDuration(long durInMillis)
Creates a duration with an amount of time in millis. |
|
XdtDuration(java.lang.String durs)
Creates a duration by parsing its string representation, in format as defined in XSD duration standard. |
Method Summary | |
static java.util.GregorianCalendar |
add(java.util.GregorianCalendar gc,
XdtDuration d)
Adds a duration expressed by an XdtDuration param d to a time
in gregorian calendar format. |
XdtDuration |
add(XdtDuration arg)
Arithmetic addition between this and param arg . |
java.lang.Object |
clone()
|
int |
compareTo(XdtDuration d)
Compares this duration with param d . |
XdtDuration |
divide(double arg)
Arithmetic division between this and param arg in milliseconds. |
double |
divide(XdtDuration arg)
Arithmetic division between this and param arg . |
boolean |
equals(java.lang.Object o)
|
int |
getDay()
|
int |
getHour()
|
int |
getMinute()
|
int |
getMonth()
|
double |
getSecond()
Field second not integer because it contains also millisecond value. |
int |
getYear()
|
boolean |
isPositive()
|
XdtDuration |
multiply(double arg)
Arithmetic multiplication between this and param arg in milliseconds. |
XdtDuration |
negate()
Returns opposite version of this . |
static XdtDuration |
subtract(java.util.GregorianCalendar gc1,
java.util.GregorianCalendar gc2)
Subtraction of two date gc1 and gc2 expressed as gregorian calendar.
|
static java.util.GregorianCalendar |
subtract(java.util.GregorianCalendar gc,
XdtDuration d)
Subtracts a duration expressed by an XdtDuration param d from a time
in gregorian calendar format. |
XdtDuration |
subtract(XdtDuration arg)
Arithmetic subtraction between this and param arg . |
long |
toMillis()
Converts this into a number of milliseconds, possibly negative. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final XdtDuration MAX_VALUE
XdtDuration
can take.
Constructor Detail |
public XdtDuration()
public XdtDuration(long durInMillis)
durInMillis
- amount of time in millis to convert as durationpublic XdtDuration(int y, int m, int d, int h, int mn, double sec, boolean sign)
sign
can inform about the sign of the value.
y
- the year countm
- the month countd
- the day counth
- the hour countmn
- the minute countsec
- the second count (including millis : 2.33 seconds means 2 seconds 33 millis)sign
- true if duration is positive, false elsepublic XdtDuration(java.lang.String durs) throws java.lang.IllegalArgumentException
durs
- the string representation of a duration
java.lang.IllegalArgumentException
- if format is invalidMethod Detail |
public java.lang.Object clone()
public boolean equals(java.lang.Object o)
public java.lang.String toString()
public int getYear()
public int getMonth()
public int getDay()
public int getHour()
public int getMinute()
public double getSecond()
second
not integer because it contains also millisecond value.
public boolean isPositive()
public long toMillis()
this
into a number of milliseconds, possibly negative.
this
duration as millisecond countpublic int compareTo(XdtDuration d)
this
duration with param d
.
d
- duration to compare to
this
is inferior to d
,
1 if this
is superior to d
, 0 if both values are equal.public XdtDuration negate()
this
.
this
.public XdtDuration add(XdtDuration arg)
this
and param arg
.
arg
- duration to add to this
public XdtDuration subtract(XdtDuration arg)
this
and param arg
.
arg
- duration to subtract from this
public double divide(XdtDuration arg)
this
and param arg
.
arg
- duration to divide from this
public XdtDuration divide(double arg)
this
and param arg
in milliseconds.
arg
- duration to divide from this
expressed in milliseconds
public XdtDuration multiply(double arg)
this
and param arg
in milliseconds.
arg
- duration to multiply from this
expressed in milliseconds
public static java.util.GregorianCalendar add(java.util.GregorianCalendar gc, XdtDuration d)
XdtDuration
param d
to a time
in gregorian calendar format.
gc
- a date as gregorian calendard
- a duration
public static java.util.GregorianCalendar subtract(java.util.GregorianCalendar gc, XdtDuration d)
XdtDuration
param d
from a time
in gregorian calendar format.
gc
- a date as gregorian calendard
- a duration
public static XdtDuration subtract(java.util.GregorianCalendar gc1, java.util.GregorianCalendar gc2)
gc1
and gc2
expressed as gregorian calendar.
Result is a duration.
gc1
- a reference dategc2
- a date to subtract
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |