|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xmlbeans.GDuration
Represents an XML Schema-compatible duration.
A duration is made up of a number of years, months, days, hours, minutes, seconds, and fractions of seconds. See the XML Schema specification section on xs:duration for details on the rules for comparing durations and adding durations to dates.
Constructor Summary | |
GDuration()
Constructs an empty GDuration representing zero seconds. |
|
GDuration(CharSequence str)
Constructs a GDuration from a lexical representation. |
|
GDuration(GDurationSpecification gDuration)
Constructs a GDuration from another GDurationSpecification. |
|
GDuration(int sign,
int year,
int month,
int day,
int hour,
int minute,
int second,
BigDecimal fraction)
Constructs a GDuration with the specified sign, year, month, day, hours, minutes, seconds, and optional fractional seconds. |
Method Summary | |
GDuration |
add(GDurationSpecification duration)
Returns a new GDuration which is the sum of this one and the supplied duration. |
Object |
clone()
Builds another GDate with the same value as this one. |
int |
compareToGDuration(GDurationSpecification duration)
Comparison to another GDuration. |
boolean |
equals(Object obj)
Two GDurations are equal if all their fields are equal. |
int |
getDay()
Gets the day-of-month component. |
BigDecimal |
getFraction()
Gets the fraction-of-second. |
int |
getHour()
Gets the hour-of-day component. |
int |
getMinute()
Gets the minute-of-hour component. |
int |
getMonth()
Gets the month-of-year component. |
int |
getSecond()
Gets the second-of-minute component. |
int |
getSign()
Returns the sign of the duration: +1 is forwards and -1 is backwards in time. |
int |
getYear()
Gets the year component. |
int |
hashCode()
|
boolean |
isImmutable()
All GDuration instances return true. |
boolean |
isValid()
Returns true if all of the individual components of the duration are nonnegative. |
GDuration |
subtract(GDurationSpecification duration)
Returns a new GDuration which is the result of subtracting the supplied duration from this one. |
String |
toString()
The natural string representation of the duration. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GDuration()
public GDuration(CharSequence str)
public GDuration(int sign, int year, int month, int day, int hour, int minute, int second, BigDecimal fraction)
sign
- +1 for a positive duration, -1 for a negative duration
IllegalArgumentException
- if the sign is not 1 or -1public GDuration(GDurationSpecification gDuration)
Method Detail |
public Object clone()
public final boolean isImmutable()
isImmutable
in interface GDurationSpecification
public final int getSign()
getSign
in interface GDurationSpecification
public final int getYear()
getYear
in interface GDurationSpecification
public final int getMonth()
getMonth
in interface GDurationSpecification
public final int getDay()
getDay
in interface GDurationSpecification
public final int getHour()
getHour
in interface GDurationSpecification
public final int getMinute()
getMinute
in interface GDurationSpecification
public final int getSecond()
getSecond
in interface GDurationSpecification
public BigDecimal getFraction()
getFraction
in interface GDurationSpecification
public boolean isValid()
isValid
in interface GDurationSpecification
public final int compareToGDuration(GDurationSpecification duration)
compareToGDuration
in interface GDurationSpecification
public String toString()
Any components that are zero are omitted. Note that if the duration is invalid, i.e., it has negative components, those negative components are serialized out here. To check for validity, use the isValid() method; and to normalize most durations to a valid form use the normalize() method.
public GDuration add(GDurationSpecification duration)
public GDuration subtract(GDurationSpecification duration)
public boolean equals(Object obj)
public int hashCode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |