org.basex.query.value.item
Class Dec

java.lang.Object
  extended by org.basex.data.ExprInfo
      extended by org.basex.query.expr.Expr
          extended by org.basex.query.value.Value
              extended by org.basex.query.value.item.Item
                  extended by org.basex.query.value.item.ANum
                      extended by org.basex.query.value.item.Dec
All Implemented Interfaces:
java.lang.Iterable<Item>

public final class Dec
extends ANum

Decimal item (xs:decimal).

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Flag
 
Field Summary
static java.math.BigDecimal MAXULNG
          Maximum unsigned long values.
 
Fields inherited from class org.basex.query.value.item.Item
score, UNDEF
 
Fields inherited from class org.basex.query.value.Value
type
 
Constructor Summary
Dec(java.math.BigDecimal d, Type t)
          Constructor.
Dec(byte[] t)
          Constructor.
 
Method Summary
 boolean bool(InputInfo ii)
          Returns a boolean representation of the value.
 double dbl()
          Returns an double representation of the value.
 java.math.BigDecimal dec(InputInfo ii)
          Returns a decimal representation of the value.
 int diff(Item it, Collation coll, InputInfo ii)
          Returns the difference between the current and the specified item.
 boolean eq(Item it, Collation coll, InputInfo ii)
          Checks the items for equality.
 float flt()
          Returns an float representation of the value.
static Dec get(java.math.BigDecimal d)
          Constructor.
static Dec get(double d)
          Constructor.
 long itr()
          Returns an integer (long) representation of the value.
static java.math.BigDecimal parse(byte[] val, InputInfo ii)
          Converts the given token into a decimal value.
static java.math.BigDecimal parse(double val, InputInfo ii)
          Converts the given double into a decimal value.
 byte[] string()
          Returns a string representation of the value.
 java.lang.Object toJava()
          Returns a Java representation of the value.
 
Methods inherited from class org.basex.query.value.item.ANum
dbl, flt, hash, itr, string, test, toString
 
Methods inherited from class org.basex.query.value.item.Item
castErr, comparable, description, ebv, equiv, homogeneous, input, isItem, item, itemAt, iter, iterable, materialize, plan, score, score, size, type, typeId, writeTo, xdmInfo
 
Methods inherited from class org.basex.query.value.Value
accept, cache, checkUp, compile, copy, count, data, exprSize, has, inline, isValue, iter, iterator, removable, serialize, value
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isVacuous, markTailCalls, optimize, sameAs, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXULNG

public static final java.math.BigDecimal MAXULNG
Maximum unsigned long values.

Constructor Detail

Dec

public Dec(byte[] t)
Constructor.

Parameters:
t - string representation

Dec

public Dec(java.math.BigDecimal d,
           Type t)
Constructor.

Parameters:
d - decimal value
t - string representation
Method Detail

get

public static Dec get(java.math.BigDecimal d)
Constructor.

Parameters:
d - big decimal value
Returns:
value

get

public static Dec get(double d)
Constructor.

Parameters:
d - big decimal value
Returns:
value

string

public byte[] string()
Description copied from class: ANum
Returns a string representation of the value.

Specified by:
string in class ANum
Returns:
string value

bool

public boolean bool(InputInfo ii)
Description copied from class: Item
Returns a boolean representation of the value.

Overrides:
bool in class Item
Parameters:
ii - input info
Returns:
boolean value

itr

public long itr()
Description copied from class: ANum
Returns an integer (long) representation of the value.

Specified by:
itr in class ANum
Returns:
long value

flt

public float flt()
Description copied from class: ANum
Returns an float representation of the value.

Specified by:
flt in class ANum
Returns:
float value

dbl

public double dbl()
Description copied from class: ANum
Returns an double representation of the value.

Specified by:
dbl in class ANum
Returns:
double value

dec

public java.math.BigDecimal dec(InputInfo ii)
Description copied from class: Item
Returns a decimal representation of the value.

Overrides:
dec in class Item
Parameters:
ii - input info
Returns:
decimal value

eq

public boolean eq(Item it,
                  Collation coll,
                  InputInfo ii)
           throws QueryException
Description copied from class: Item
Checks the items for equality.

Specified by:
eq in class Item
Parameters:
it - item to be compared
coll - collation
ii - input info
Returns:
result of check
Throws:
QueryException - query exception

diff

public int diff(Item it,
                Collation coll,
                InputInfo ii)
         throws QueryException
Description copied from class: Item
Returns the difference between the current and the specified item.

Overrides:
diff in class Item
Parameters:
it - item to be compared
coll - query context
ii - input info
Returns:
difference
Throws:
QueryException - query exception

toJava

public java.lang.Object toJava()
Description copied from class: Value
Returns a Java representation of the value.

Specified by:
toJava in class Value
Returns:
Java object

parse

public static java.math.BigDecimal parse(double val,
                                         InputInfo ii)
                                  throws QueryException
Converts the given double into a decimal value.

Parameters:
val - value to be converted
ii - input info
Returns:
double value
Throws:
QueryException - query exception

parse

public static java.math.BigDecimal parse(byte[] val,
                                         InputInfo ii)
                                  throws QueryException
Converts the given token into a decimal value.

Parameters:
val - value to be converted
ii - input info
Returns:
double value
Throws:
QueryException - query exception