org.basex.query.value.item
Class ADateDur

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.ADateDur
All Implemented Interfaces:
java.lang.Iterable<Item>
Direct Known Subclasses:
ADate, Dur

public abstract class ADateDur
extends Item

Abstract super class for dates and durations.

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
protected static java.math.BigDecimal BD100
          BigDecimal: 100.
protected static java.math.BigDecimal BD1000
          BigDecimal: 1000.
protected static java.math.BigDecimal BD146097
          BigDecimal: 146097.
protected static java.math.BigDecimal BD1461
          BigDecimal: 1461.
protected static java.math.BigDecimal BD153
          BigDecimal: 153.
protected static java.math.BigDecimal BD2
          BigDecimal: 2.
protected static java.math.BigDecimal BD3600
          BigDecimal: 60.
protected static java.math.BigDecimal BD365
          BigDecimal: 365.
protected static java.math.BigDecimal BD36524
          BigDecimal: 36524.
protected static java.math.BigDecimal BD36525
          BigDecimal: 36525.
protected static java.math.BigDecimal BD366
          BigDecimal: 366.
protected static java.math.BigDecimal BD4
          BigDecimal: 4.
protected static java.math.BigDecimal BD5
          BigDecimal: 5.
protected static java.math.BigDecimal BD60
          BigDecimal: 60.
static java.math.BigDecimal BDMAXLONG
          Maximum long value.
protected static java.math.BigDecimal DAYSECONDS
          Seconds per day.
 java.math.BigDecimal sec
          Seconds and milliseconds (0-59.\d+).
 
Fields inherited from class org.basex.query.value.item.Item
score, UNDEF
 
Fields inherited from class org.basex.query.value.Value
type
 
Constructor Summary
protected ADateDur(Type t)
          Constructor.
 
Method Summary
protected  QueryException dateErr(byte[] i, java.lang.String ex, InputInfo ii)
          Throws a date format exception.
abstract  long day()
          Returns the days.
abstract  long hou()
          Returns the hours (0-23).
abstract  long min()
          Returns the minutes (0-59).
abstract  long mon()
          Returns the months.
abstract  java.math.BigDecimal sec()
          Returns the seconds (0-59), including the fractional part.
protected  java.math.BigDecimal toDecimal(java.lang.String s, boolean dur, InputInfo ii)
          Date and durations: converts the specified string to a decimal value.
protected  long toLong(java.lang.String s, boolean dur, InputInfo ii)
          Date and durations: converts the specified string to an integer value.
abstract  long yea()
          Returns the years.
 
Methods inherited from class org.basex.query.value.item.Item
bool, castErr, comparable, dbl, dec, description, diff, ebv, eq, equiv, flt, hash, homogeneous, input, isItem, item, itemAt, iter, iterable, itr, materialize, plan, score, score, size, string, test, 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, toJava, 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, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BDMAXLONG

public static final java.math.BigDecimal BDMAXLONG
Maximum long value.


DAYSECONDS

protected static final java.math.BigDecimal DAYSECONDS
Seconds per day.


BD146097

protected static final java.math.BigDecimal BD146097
BigDecimal: 146097.


BD36525

protected static final java.math.BigDecimal BD36525
BigDecimal: 36525.


BD36524

protected static final java.math.BigDecimal BD36524
BigDecimal: 36524.


BD3600

protected static final java.math.BigDecimal BD3600
BigDecimal: 60.


BD1461

protected static final java.math.BigDecimal BD1461
BigDecimal: 1461.


BD1000

protected static final java.math.BigDecimal BD1000
BigDecimal: 1000.


BD366

protected static final java.math.BigDecimal BD366
BigDecimal: 366.


BD365

protected static final java.math.BigDecimal BD365
BigDecimal: 365.


BD153

protected static final java.math.BigDecimal BD153
BigDecimal: 153.


BD100

protected static final java.math.BigDecimal BD100
BigDecimal: 100.


BD60

protected static final java.math.BigDecimal BD60
BigDecimal: 60.


BD5

protected static final java.math.BigDecimal BD5
BigDecimal: 5.


BD4

protected static final java.math.BigDecimal BD4
BigDecimal: 4.


BD2

protected static final java.math.BigDecimal BD2
BigDecimal: 2.


sec

public java.math.BigDecimal sec
Seconds and milliseconds (0-59.\d+). -1: undefined.

Constructor Detail

ADateDur

protected ADateDur(Type t)
Constructor.

Parameters:
t - data type
Method Detail

yea

public abstract long yea()
Returns the years.

Returns:
year

mon

public abstract long mon()
Returns the months.

Returns:
year

day

public abstract long day()
Returns the days.

Returns:
day

hou

public abstract long hou()
Returns the hours (0-23).

Returns:
day

min

public abstract long min()
Returns the minutes (0-59).

Returns:
day

sec

public abstract java.math.BigDecimal sec()
Returns the seconds (0-59), including the fractional part.

Returns:
day

dateErr

protected final QueryException dateErr(byte[] i,
                                       java.lang.String ex,
                                       InputInfo ii)
                                throws QueryException
Throws a date format exception.

Parameters:
i - input
ex - example format
ii - input info
Returns:
never
Throws:
QueryException - query exception

toLong

protected long toLong(java.lang.String s,
                      boolean dur,
                      InputInfo ii)
               throws QueryException
Date and durations: converts the specified string to an integer value. Returns an exception if the value is invalid.

Parameters:
s - string to be converted
dur - duration
ii - input info
Returns:
long value
Throws:
QueryException - query exception

toDecimal

protected java.math.BigDecimal toDecimal(java.lang.String s,
                                         boolean dur,
                                         InputInfo ii)
                                  throws QueryException
Date and durations: converts the specified string to a decimal value. Returns an exception if the value is invalid.

Parameters:
s - string to be converted
dur - duration
ii - input info
Returns:
decimal
Throws:
QueryException - query exception