Package org.basex.query.value.item
Class ADate
- java.lang.Object
-
- org.basex.query.expr.ExprInfo
-
- org.basex.query.expr.Expr
-
- org.basex.query.value.Value
-
- org.basex.query.value.item.Item
-
- org.basex.query.value.item.ADateDur
-
- org.basex.query.value.item.ADate
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
atomicEqual(Item item)
Compares items for atomic equality.int
compare(Item item, Collation coll, boolean transitive, InputInfo ii)
Compares the current and the specified item.long
day()
Returns the days.BigDecimal
daySeconds()
Returns the seconds of one day.static int
daysOfMonth(long year, int month)
Returns the number of days of the specified month, considering leap years.boolean
deepEqual(Item item, DeepEqual deep)
Compares items for deep equality.boolean
equal(Item item, Collation coll, InputInfo ii)
Compares items for equality.boolean
equals(Object obj)
This function is e.g.int
hash()
Returns a hash code for an atomic item.boolean
hasTz()
Returns if the timezone is defined.long
hour()
Returns the hours (0-23).long
minute()
Returns the minutes (0-59).long
mon()
Returns the months.BigDecimal
sec()
Returns the seconds (0-59), including the fractional part.byte[]
string(InputInfo ii)
Returns a string representation of the value.abstract ADate
timeZone(DTDur dur, boolean undefined, InputInfo info)
Creates a new item with an adjusted timezone.XMLGregorianCalendar
toJava()
Returns a Java representation of the value.void
toString(QueryString qs)
Creates a query string.int
tz()
Returns the timezone in minutes.protected void
tz(DTDur dur, boolean undefined, InputInfo info)
Adjusts the timezone.long
yea()
Returns the years.-
Methods inherited from class org.basex.query.value.item.Item
atomItem, atomValue, bool, cache, comparable, dbl, ddo, dec, description, flt, input, instanceOf, isItem, item, itemAt, iter, itr, materialize, materialized, refineType, refineType, reverse, sameType, score, seqType, size, stringInput, subsequence, test, toXml, typeId, write, xdmInfo
-
Methods inherited from class org.basex.query.value.Value
accept, checkUp, compile, copy, count, exprSize, has, inline, inlineable, isEmpty, iter, iterator, refineType, serialize, serialize, serialize, value
-
Methods inherited from class org.basex.query.expr.Expr
arg, args, atomIter, data, funcType, hasFreeVars, indexAccessible, info, isSimple, markTailCalls, mergeEbv, optimize, optimizePos, simplify, simplifyFor, typeCheck, uses, vacuous, visitAll
-
Methods inherited from class org.basex.query.expr.ExprInfo
info, toErrorString, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
timeZone
public abstract ADate timeZone(DTDur dur, boolean undefined, InputInfo info) throws QueryException
Creates a new item with an adjusted timezone.- Parameters:
dur
- duration to add to the timezone (ifnull
, assign implicit timezone)undefined
- invalidate timezoneinfo
- input info (can benull
)- Returns:
- new item
- Throws:
QueryException
- query exception
-
tz
protected void tz(DTDur dur, boolean undefined, InputInfo info) throws QueryException
Adjusts the timezone.- Parameters:
dur
- duration to add to the timezone (ifnull
, assign implicit timezone)undefined
- invalidate timezoneinfo
- input info (can benull
)- Throws:
QueryException
- query exception
-
yea
public final long yea()
Description copied from class:ADateDur
Returns the years.
-
mon
public final long mon()
Description copied from class:ADateDur
Returns the months.
-
day
public final long day()
Description copied from class:ADateDur
Returns the days.
-
hour
public final long hour()
Description copied from class:ADateDur
Returns the hours (0-23).
-
minute
public final long minute()
Description copied from class:ADateDur
Returns the minutes (0-59).
-
sec
public final BigDecimal sec()
Description copied from class:ADateDur
Returns the seconds (0-59), including the fractional part.
-
tz
public final int tz()
Returns the timezone in minutes.- Returns:
- time zone
-
hasTz
public final boolean hasTz()
Returns if the timezone is defined.- Returns:
- time zone
-
string
public byte[] string(InputInfo ii)
Description copied from class:Item
Returns a string representation of the value.
-
equal
public final boolean equal(Item item, Collation coll, InputInfo ii) throws QueryException
Description copied from class:Item
Compares items for equality. Called byCmpV.OpV
.- Specified by:
equal
in classItem
- Parameters:
item
- item to be comparedcoll
- collation (can benull
)ii
- input info (can benull
)- Returns:
- result of check
- Throws:
QueryException
- query exception
-
deepEqual
public final boolean deepEqual(Item item, DeepEqual deep) throws QueryException
Description copied from class:Item
Compares items for deep equality. Called byDeepEqual
.- Overrides:
deepEqual
in classItem
- Parameters:
item
- item to be compareddeep
- comparator- Returns:
- result of check
- Throws:
QueryException
- query exception
-
atomicEqual
public final boolean atomicEqual(Item item) throws QueryException
Description copied from class:Item
Compares items for atomic equality. Called byFnAtomicEqual
.- Overrides:
atomicEqual
in classItem
- Parameters:
item
- item to be compared- Returns:
- result of check
- Throws:
QueryException
- query exception
-
hash
public final int hash()
Description copied from class:Item
Returns a hash code for an atomic item. The returned values must be suitable for comparison according to the deep-equal rules.
-
compare
public int compare(Item item, Collation coll, boolean transitive, InputInfo ii) throws QueryException
Compares the current and the specified item. Overwritten byGDt
.- Overrides:
compare
in classItem
- Parameters:
item
- item to be comparedcoll
- collation (can benull
)transitive
- transitive comparisonii
- input info (can benull
)- Returns:
- difference
- Throws:
QueryException
- query exception
-
toJava
public final XMLGregorianCalendar toJava()
Description copied from class:Value
Returns a Java representation of the value.
-
daySeconds
public final BigDecimal daySeconds()
Returns the seconds of one day.- Returns:
- seconds
-
daysOfMonth
public static int daysOfMonth(long year, int month)
Returns the number of days of the specified month, considering leap years.- Parameters:
year
- yearmonth
- month- Returns:
- days
-
equals
public final boolean equals(Object obj)
Description copied from class:Expr
This function is e.g. called by:If.optimize(CompileContext)
,Switch.optimize(CompileContext)
,Typeswitch.optimize(CompileContext)
, in order to discard identical expressions.CmpR.mergeEbv(Expr, boolean, CompileContext)
orCmpSR.mergeEbv(Expr, boolean, CompileContext)
, in order to merge expressions with identical input.CmpG.optimize(CompileContext)
orCmpV.optimize(CompileContext)
, in order to pre-evaluate equality tests.CmpG.optimize(CompileContext)
, in order to compare the start and end value.PathCache
, in order to find identical root values at runtime.
-
toString
public final void toString(QueryString qs)
Description copied from class:ExprInfo
Creates a query string.
-
-