org.exist.xquery.value
Class DurationValue

java.lang.Object
  extended byorg.exist.xquery.value.AtomicValue
      extended byorg.exist.xquery.value.ComputableValue
          extended byorg.exist.xquery.value.DurationValue
All Implemented Interfaces:
Item, Sequence
Direct Known Subclasses:
org.exist.xquery.value.OrderedDurationValue

public class DurationValue
extends ComputableValue

Author:
Piotr Kaminski

Field Summary
static int DAY
           
protected  Duration duration
           
static int HOUR
           
static int MINUTE
           
static int MONTH
           
protected static java.math.BigInteger SIXTY
           
protected static java.math.BigDecimal SIXTY_DECIMAL
           
protected static java.math.BigInteger TWELVE
           
protected static java.math.BigInteger TWENTY_FOUR
           
static int YEAR
           
protected static java.math.BigDecimal ZERO_DECIMAL
           
 
Fields inherited from class org.exist.xquery.value.AtomicValue
EMPTY_VALUE
 
Fields inherited from interface org.exist.xquery.value.Sequence
EMPTY_SEQUENCE
 
Constructor Summary
DurationValue(Duration duration)
           
 
Method Summary
protected  Duration canonicalZeroDuration()
           
 int compareTo(java.text.Collator collator, AtomicValue other)
           
 boolean compareTo(java.text.Collator collator, int operator, AtomicValue other)
           
 int conversionPreference(java.lang.Class target)
          Returns a preference indicator, indicating the preference of a value to be converted into the given Java class.
 AtomicValue convertTo(int requiredType)
          Convert this item into an atomic value, whose type corresponds to the specified target type.
protected  DurationValue createSameKind(Duration d)
           
 ComputableValue div(ComputableValue other)
           
 Duration getCanonicalDuration()
           
 int getPart(int part)
           
 double getSeconds()
           
 java.lang.String getStringValue()
          Return the string value of this item (see the definition of string value in XPath).
 int getType()
          Return the type of this item according to the type constants defined in class Type.
 AtomicValue max(java.text.Collator collator, AtomicValue other)
           
 AtomicValue min(java.text.Collator collator, AtomicValue other)
           
 ComputableValue minus(ComputableValue other)
           
protected  java.math.BigInteger monthsValue()
           
protected  java.math.BigInteger monthsValueSigned()
           
 ComputableValue mult(ComputableValue other)
           
 DurationValue negate()
           
 ComputableValue plus(ComputableValue other)
           
protected  java.math.BigDecimal secondsValue()
           
protected  java.math.BigDecimal secondsValueSigned()
           
 java.lang.Object toJavaObject(java.lang.Class target)
          Convert the value into an instance of the specified Java class.
 
Methods inherited from class org.exist.xquery.value.AtomicValue
add, addAll, atomize, clearContext, contains, copyTo, dump, effectiveBooleanValue, endsWith, getCardinality, getDocumentSet, getItemType, getLength, isCached, isPersistentSet, itemAt, iterate, removeDuplicates, setIsCached, setSelfAsContext, startsWith, toNodeSet, toSAX, toSequence, toString, unorderedIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

YEAR

public static final int YEAR
See Also:
Constant Field Values

MONTH

public static final int MONTH
See Also:
Constant Field Values

DAY

public static final int DAY
See Also:
Constant Field Values

HOUR

public static final int HOUR
See Also:
Constant Field Values

MINUTE

public static final int MINUTE
See Also:
Constant Field Values

duration

protected final Duration duration

TWELVE

protected static final java.math.BigInteger TWELVE

TWENTY_FOUR

protected static final java.math.BigInteger TWENTY_FOUR

SIXTY

protected static final java.math.BigInteger SIXTY

SIXTY_DECIMAL

protected static final java.math.BigDecimal SIXTY_DECIMAL

ZERO_DECIMAL

protected static final java.math.BigDecimal ZERO_DECIMAL
Constructor Detail

DurationValue

public DurationValue(Duration duration)
              throws XPathException
Method Detail

getCanonicalDuration

public Duration getCanonicalDuration()

getType

public int getType()
Description copied from interface: Item
Return the type of this item according to the type constants defined in class Type.

Specified by:
getType in interface Item
Overrides:
getType in class AtomicValue

createSameKind

protected DurationValue createSameKind(Duration d)
                                throws XPathException
Throws:
XPathException

negate

public DurationValue negate()
                     throws XPathException
Throws:
XPathException

getStringValue

public java.lang.String getStringValue()
Description copied from interface: Item
Return the string value of this item (see the definition of string value in XPath).

Specified by:
getStringValue in interface Item
Specified by:
getStringValue in class ComputableValue

secondsValue

protected java.math.BigDecimal secondsValue()

secondsValueSigned

protected java.math.BigDecimal secondsValueSigned()

monthsValue

protected java.math.BigInteger monthsValue()

monthsValueSigned

protected java.math.BigInteger monthsValueSigned()

canonicalZeroDuration

protected Duration canonicalZeroDuration()

getPart

public int getPart(int part)

getSeconds

public double getSeconds()

convertTo

public AtomicValue convertTo(int requiredType)
                      throws XPathException
Description copied from interface: Item
Convert this item into an atomic value, whose type corresponds to the specified target type. requiredType should be one of the type constants defined in Type. An XPathException is thrown if the conversion is impossible.

Specified by:
convertTo in interface Item
Specified by:
convertTo in class ComputableValue
Throws:
XPathException

compareTo

public boolean compareTo(java.text.Collator collator,
                         int operator,
                         AtomicValue other)
                  throws XPathException
Specified by:
compareTo in class ComputableValue
Throws:
XPathException

compareTo

public int compareTo(java.text.Collator collator,
                     AtomicValue other)
              throws XPathException
Specified by:
compareTo in class ComputableValue
Throws:
XPathException

max

public AtomicValue max(java.text.Collator collator,
                       AtomicValue other)
                throws XPathException
Specified by:
max in class ComputableValue
Throws:
XPathException

min

public AtomicValue min(java.text.Collator collator,
                       AtomicValue other)
                throws XPathException
Specified by:
min in class ComputableValue
Throws:
XPathException

minus

public ComputableValue minus(ComputableValue other)
                      throws XPathException
Specified by:
minus in class ComputableValue
Throws:
XPathException

plus

public ComputableValue plus(ComputableValue other)
                     throws XPathException
Specified by:
plus in class ComputableValue
Throws:
XPathException

mult

public ComputableValue mult(ComputableValue other)
                     throws XPathException
Specified by:
mult in class ComputableValue
Throws:
XPathException

div

public ComputableValue div(ComputableValue other)
                    throws XPathException
Specified by:
div in class ComputableValue
Throws:
XPathException

conversionPreference

public int conversionPreference(java.lang.Class target)
Description copied from interface: Sequence
Returns a preference indicator, indicating the preference of a value to be converted into the given Java class. Low numbers mean that the value can be easily converted into the given class.

Specified by:
conversionPreference in interface Item
Overrides:
conversionPreference in class AtomicValue

toJavaObject

public java.lang.Object toJavaObject(java.lang.Class target)
                              throws XPathException
Description copied from interface: Sequence
Convert the value into an instance of the specified Java class.

Specified by:
toJavaObject in interface Item
Overrides:
toJavaObject in class AtomicValue
Throws:
XPathException


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.