APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.jaxp.datatype

pack-priv Class DurationDayTimeImpl

extends DurationImpl
Class Inheritance
Imports
java.math.BigInteger, .BigDecimal, javax.xml.datatype.DatatypeConstants

Represent a subtype xdt:dayTimeDuration of a Duration as specified in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The DurationYearMonth object represents a period of Gregorian time, with a lexical representation, "PnDTnHnMnS" that contains only year and month components.

Author
Vikram Aroskar
See Also
XMLGregorianCalendar#add(Duration)

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl:
dayshoursminutesmonthssecondssignumyears

Constructor Summary

AccessConstructor and Description
public
DurationDayTimeImpl(boolean isPositive, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds)

public
DurationDayTimeImpl(boolean isPositive, int days, int hours, int minutes, int seconds)

protected
DurationDayTimeImpl(String
Lexical representation of a duration.
lexicalRepresentation
)

Construct a Duration of type xdt:dayTimeDuration by parsing its String representation, "PnDTnHnMnS", XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

protected
DurationDayTimeImpl(final long
Milliseconds of Duration to create.
durationInMilliseconds
)

Create a Duration of type xdt:dayTimeDuration using the specified milliseconds as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

Method Summary

Modifier and TypeMethod and Description
private void
public float

Returns:

fractional second values
getValue
()

The value space of xs:dayTimeDuration is the set of fractional second values.

Inherited from com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl:
addaddToaddTocalcSignumcomparegetDaysgetFieldgetHoursgetMinutesgetMonthsgetSecondsgetSigngetTimeInMillisgetTimeInMillisgetYearshashCodeisSetmultiplymultiplynegatenormalizeWithsanitizesignumsubtracttestNonNegativetestNonNegativetoStringwrap

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl.serialVersionUID.

Constructor Detail

DurationDayTimeImplback to summary
public DurationDayTimeImpl(boolean isPositive, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds)
DurationDayTimeImplback to summary
public DurationDayTimeImpl(boolean isPositive, int days, int hours, int minutes, int seconds)
DurationDayTimeImplback to summary
protected DurationDayTimeImpl(String lexicalRepresentation)

Construct a Duration of type xdt:dayTimeDuration by parsing its String representation, "PnDTnHnMnS", XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

All four values are set and availabe from the created Duration

The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException will be thrown with a message indicating implementation limits if implementation capacities are exceeded.

Parameters
lexicalRepresentation:String

Lexical representation of a duration.

Exceptions
IllegalArgumentException:
If lexicalRepresentation is not a valid representation of a Duration expressed only in terms of days and time.
UnsupportedOperationException:
If implementation cannot support requested values.
NullPointerException:
If lexicalRepresentation is null.
DurationDayTimeImplback to summary
protected DurationDayTimeImpl(final long durationInMilliseconds)

Create a Duration of type xdt:dayTimeDuration using the specified milliseconds as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration.

The datatype xdt:dayTimeDuration is a subtype of xs:duration whose lexical representation contains only day, hour, minute, and second components. This datatype resides in the namespace http://www.w3.org/2003/11/xpath-datatypes.

All four values are set by computing their values from the specified milliseconds and are availabe using the get methods of the created Duration. The values conform to and are defined by:

The default start instance is defined by GregorianCalendar's use of the start of the epoch: i.e., java.util.Calendar#YEAR = 1970, java.util.Calendar#MONTH = java.util.Calendar#JANUARY, java.util.Calendar#DATE = 1, etc. This is important as there are variations in the Gregorian Calendar, e.g. leap years have different days in the month = java.util.Calendar#FEBRUARY so the result of Duration#getDays() can be influenced.

Any remaining milliseconds after determining the day, hour, minute and second are discarded.

Parameters
durationInMilliseconds:long

Milliseconds of Duration to create.

See Also
XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration

Method Detail

convertToCanonicalDayTimeback to summary
private void convertToCanonicalDayTime()
getValueback to summary
public float getValue()

The value space of xs:dayTimeDuration is the set of fractional second values.

Returns:float

fractional second values