org.exist.xquery.value
Class DecimalValue

java.lang.Object
  extended by org.exist.xquery.value.AtomicValue
      extended by org.exist.xquery.value.ComputableValue
          extended by org.exist.xquery.value.NumericValue
              extended by org.exist.xquery.value.DecimalValue
All Implemented Interfaces:
Comparable, Indexable, Item, Sequence

public class DecimalValue
extends NumericValue

Author:
wolf

Field Summary
static BigInteger BIG_INTEGER_TEN
           
 
Fields inherited from class org.exist.xquery.value.AtomicValue
EMPTY_VALUE
 
Fields inherited from interface org.exist.xquery.value.Sequence
EMPTY_SEQUENCE
 
Constructor Summary
DecimalValue(BigDecimal decimal)
           
DecimalValue(double doubleValue)
           
DecimalValue(String str)
           
 
Method Summary
 NumericValue abs()
           
 NumericValue ceiling()
           
 boolean compareTo(Collator collator, int operator, AtomicValue other)
           
 int compareTo(Object o)
           
 int conversionPreference(Class javaClass)
          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.
 ComputableValue div(ComputableValue other)
           
 NumericValue floor()
           
 String getStringValue()
          Return the string value of this item (see the definition of string value in XPath).
 int getType()
          Returns the type of the Indexable as one of the constants defined in Type.
 boolean hasFractionalPart()
           
 IntegerValue idiv(NumericValue other)
           
 boolean isInfinite()
           
 boolean isNaN()
           
 boolean isNegative()
           
 boolean isPositive()
           
 boolean isZero()
           
 AtomicValue max(Collator collator, AtomicValue other)
           
 AtomicValue min(Collator collator, AtomicValue other)
           
 ComputableValue minus(ComputableValue other)
           
 NumericValue mod(NumericValue other)
           
 ComputableValue mult(ComputableValue other)
           
 NumericValue negate()
           
 ComputableValue plus(ComputableValue other)
           
 NumericValue round()
           
 NumericValue round(IntegerValue precision)
           
 Object toJavaObject(Class target)
          Convert the value into an instance of the specified Java class.
 
Methods inherited from class org.exist.xquery.value.NumericValue
compareTo, effectiveBooleanValue, getDouble, getInt, getLong
 
Methods inherited from class org.exist.xquery.value.AtomicValue
add, addAll, atomize, clearContext, contains, copyTo, dump, endsWith, getCardinality, getCollectionIterator, getDocumentSet, getItemCount, getItemType, getState, hasChanged, hasMany, hasOne, isCacheable, isCached, isEmpty, isPersistentSet, itemAt, iterate, nodeMoved, promote, removeDuplicates, serializeValue, setIsCached, setSelfAsContext, startsWith, toMemNodeSet, toNodeSet, toSAX, toSequence, toString, unorderedIterator
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BIG_INTEGER_TEN

public static final BigInteger BIG_INTEGER_TEN
Constructor Detail

DecimalValue

public DecimalValue(BigDecimal decimal)

DecimalValue

public DecimalValue(String str)
             throws XPathException
Throws:
XPathException

DecimalValue

public DecimalValue(double doubleValue)
Method Detail

getType

public int getType()
Description copied from interface: Indexable
Returns the type of the Indexable as one of the constants defined in Type.

Specified by:
getType in interface Indexable
Specified by:
getType in interface Item
Overrides:
getType in class AtomicValue
Returns:
Type of the Indexable

getStringValue

public String getStringValue()
                      throws XPathException
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 interface Sequence
Specified by:
getStringValue in class NumericValue
Throws:
XPathException

hasFractionalPart

public boolean hasFractionalPart()
Specified by:
hasFractionalPart in class NumericValue

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 interface Sequence
Specified by:
convertTo in class NumericValue
Parameters:
requiredType - one of the type constants defined in class Type
Throws:
XPathException

isNaN

public boolean isNaN()
Specified by:
isNaN in class NumericValue

isInfinite

public boolean isInfinite()
Specified by:
isInfinite in class NumericValue

isZero

public boolean isZero()
Specified by:
isZero in class NumericValue

isNegative

public boolean isNegative()
Specified by:
isNegative in class NumericValue

isPositive

public boolean isPositive()
Specified by:
isPositive in class NumericValue

negate

public NumericValue negate()
                    throws XPathException
Specified by:
negate in class NumericValue
Throws:
XPathException

ceiling

public NumericValue ceiling()
                     throws XPathException
Specified by:
ceiling in class NumericValue
Throws:
XPathException

floor

public NumericValue floor()
                   throws XPathException
Specified by:
floor in class NumericValue
Throws:
XPathException

round

public NumericValue round()
                   throws XPathException
Specified by:
round in class NumericValue
Throws:
XPathException

round

public NumericValue round(IntegerValue precision)
                   throws XPathException
Specified by:
round in class NumericValue
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

idiv

public IntegerValue idiv(NumericValue other)
                  throws XPathException
Specified by:
idiv in class NumericValue
Throws:
XPathException

mod

public NumericValue mod(NumericValue other)
                 throws XPathException
Specified by:
mod in class NumericValue
Throws:
XPathException

abs

public NumericValue abs()
                 throws XPathException
Specified by:
abs in class NumericValue
Throws:
XPathException

max

public AtomicValue max(Collator collator,
                       AtomicValue other)
                throws XPathException
Specified by:
max in class NumericValue
Throws:
XPathException

min

public AtomicValue min(Collator collator,
                       AtomicValue other)
                throws XPathException
Specified by:
min in class NumericValue
Throws:
XPathException

compareTo

public boolean compareTo(Collator collator,
                         int operator,
                         AtomicValue other)
                  throws XPathException
Overrides:
compareTo in class NumericValue
Throws:
XPathException

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class AtomicValue

conversionPreference

public int conversionPreference(Class javaClass)
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
Specified by:
conversionPreference in interface Sequence
Overrides:
conversionPreference in class AtomicValue

toJavaObject

public Object toJavaObject(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
Specified by:
toJavaObject in interface Sequence
Overrides:
toJavaObject in class AtomicValue
Throws:
XPathException


Copyright (C) Wolfgang Meier. All rights reserved.