org.basex.query.xquery.item
Class Dec

java.lang.Object
  extended by org.basex.query.ExprInfo
      extended by org.basex.query.xquery.expr.Expr
          extended by org.basex.query.xquery.item.Item
              extended by org.basex.query.xquery.item.Num
                  extended by org.basex.query.xquery.item.Dec

public final class Dec
extends Num

Decimal item.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.xquery.expr.Expr
Expr.Return, Expr.Using
 
Field Summary
static Dec ZERO
          Zero value.
 
Fields inherited from class org.basex.query.xquery.item.Item
type
 
Constructor Summary
Dec(java.math.BigDecimal d, Type t)
          Constructor.
Dec(byte[] t)
          Constructor.
 
Method Summary
 boolean bool()
          Returns a boolean representation of the item.
 double dbl()
          Returns a double representation of the item.
 java.math.BigDecimal dec()
          Returns a decimal representation of the item.
 int diff(Item it)
          Returns the difference between the current and the specified item.
 boolean eq(Item it)
          Checks the items for equality.
 float flt()
          Returns a float representation of the item.
static Dec get(java.math.BigDecimal d)
          Constructor.
 int hash()
          Returns a hash code.
static Iter iter(java.math.BigDecimal v)
          Returns an iterator.
static Iter iter(double d)
          Returns an iterator.
 long itr()
          Returns an integer (long) representation of the item.
 java.lang.Object java()
          Returns a Java object.
static java.math.BigDecimal parse(byte[] val)
          Converts the given token into a decimal value.
static java.math.BigDecimal parse(double val)
          Converts the given double into a decimal value.
 byte[] str()
          Returns an atomized string.
 
Methods inherited from class org.basex.query.xquery.item.Item
castErr, comp, d, i, iter, iter, n, name, node, plan, returned, s, score, score, serialize, size, toString, u, uses
 
Methods inherited from class org.basex.query.xquery.expr.Expr
e
 
Methods inherited from class org.basex.query.ExprInfo
color, info
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final Dec ZERO
Zero value.

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

iter

public static Iter iter(java.math.BigDecimal v)
Returns an iterator.

Parameters:
v - double value
Returns:
iterator

iter

public static Iter iter(double d)
Returns an iterator.

Parameters:
d - double value
Returns:
iterator

str

public byte[] str()
Description copied from class: Item
Returns an atomized string.

Overrides:
str in class Item
Returns:
string representation

bool

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

Overrides:
bool in class Item
Returns:
boolean value

itr

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

Overrides:
itr in class Item
Returns:
long value

flt

public float flt()
Description copied from class: Item
Returns a float representation of the item.

Overrides:
flt in class Item
Returns:
float value

dbl

public double dbl()
Description copied from class: Item
Returns a double representation of the item.

Overrides:
dbl in class Item
Returns:
double value

dec

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

Overrides:
dec in class Item
Returns:
decimal value

eq

public boolean eq(Item it)
           throws XQException
Description copied from class: Item
Checks the items for equality.

Specified by:
eq in class Item
Parameters:
it - item to be compared.
Returns:
result of check
Throws:
XQException - evaluation exception

diff

public int diff(Item it)
         throws XQException
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.
Returns:
difference
Throws:
XQException - evaluation exception

hash

public int hash()
Description copied from class: Item
Returns a hash code.

Overrides:
hash in class Item
Returns:
hash code

java

public java.lang.Object java()
Description copied from class: Item
Returns a Java object.

Overrides:
java in class Item
Returns:
string representation

parse

public static java.math.BigDecimal parse(double val)
                                  throws XQException
Converts the given double into a decimal value.

Parameters:
val - value to be converted
Returns:
double value
Throws:
XQException - possible converting exception

parse

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

Parameters:
val - value to be converted
Returns:
double value
Throws:
XQException - possible converting exception