Package org.basex.query.value.item
Class ANum
- 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.ANum
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ANum
abs()
Returns an absolute value.boolean
atomicEqual(Item item)
Compares items for atomic equality.abstract ANum
ceiling()
Returns an ceiling value.boolean
comparable(Item item)
Checks if the items can be compared.abstract double
dbl()
Returns a double representation of the value.double
dbl(InputInfo ii)
Returns a double representation of the value.abstract ANum
floor()
Returns an floor value.protected abstract float
flt()
Returns a float representation of the value.float
flt(InputInfo ii)
Returns a float representation of the value.int
hash()
Returns a hash code for an atomic item.abstract long
itr()
Returns an integer (long) representation of the value.long
itr(InputInfo ii)
Returns an integer (long) representation of the value.Expr
optimizePos(CmpV.OpV op, CompileContext cc)
Optimizes an expression for positional access.abstract ANum
round(int scale, boolean even)
Returns a rounded value.Expr
simplifyFor(CompileContext.Simplify mode, CompileContext cc)
Simplifies the expression.protected abstract byte[]
string()
Returns a string representation of the value.byte[]
string(InputInfo ii)
Returns a string representation of the value.boolean
test(QueryContext qc, InputInfo ii, long pos)
Computes the effective boolean value for this expression.void
toString(QueryString qs)
Creates a query string.-
Methods inherited from class org.basex.query.value.item.Item
atomItem, atomValue, bool, cache, compare, ddo, dec, deepEqual, description, equal, input, instanceOf, isItem, item, itemAt, iter, materialize, materialized, refineType, refineType, reverse, sameType, score, seqType, size, stringInput, subsequence, 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, toJava, value
-
Methods inherited from class org.basex.query.expr.Expr
arg, args, atomIter, data, equals, funcType, hasFreeVars, indexAccessible, info, isSimple, markTailCalls, mergeEbv, optimize, simplify, 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
-
string
public final byte[] string(InputInfo ii)
Description copied from class:Item
Returns a string representation of the value.
-
dbl
public final double dbl(InputInfo ii)
Description copied from class:Item
Returns a double representation of the value.
-
itr
public final long itr(InputInfo ii)
Description copied from class:Item
Returns an integer (long) representation of the value.
-
flt
public final float flt(InputInfo ii)
Description copied from class:Item
Returns a float representation of the value.
-
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
-
string
protected abstract byte[] string()
Returns a string representation of the value.- Returns:
- string value
-
itr
public abstract long itr()
Returns an integer (long) representation of the value.- Returns:
- long value
-
dbl
public abstract double dbl()
Returns a double representation of the value.- Returns:
- double value
-
flt
protected abstract float flt()
Returns a float representation of the value.- Returns:
- float value
-
abs
public abstract ANum abs()
Returns an absolute value.- Returns:
- absolute value
-
ceiling
public abstract ANum ceiling()
Returns an ceiling value.- Returns:
- ceiling value
-
floor
public abstract ANum floor()
Returns an floor value.- Returns:
- floor value
-
round
public abstract ANum round(int scale, boolean even)
Returns a rounded value.- Parameters:
scale
- scaleeven
- half-to-even flag- Returns:
- rounded value
-
comparable
public final boolean comparable(Item item)
Description copied from class:Item
Checks if the items can be compared.- Overrides:
comparable
in classItem
- Parameters:
item
- item to be compared- Returns:
- result of check
-
test
public boolean test(QueryContext qc, InputInfo ii, long pos) throws QueryException
Description copied from class:Expr
Computes the effective boolean value for this expression.- Overrides:
test
in classItem
- Parameters:
qc
- query contextii
- input info (can benull
); required for thoseValue
instances that have no input info)pos
- position of context item (if0
, perform EBV test)- Returns:
- item
- Throws:
QueryException
- query exception
-
simplifyFor
public final Expr simplifyFor(CompileContext.Simplify mode, CompileContext cc) throws QueryException
Description copied from class:Expr
Simplifies the expression. Overwritten by many expressions; callsExpr.simplify(Simplify, CompileContext)
otherwise.- Overrides:
simplifyFor
in classExpr
- Parameters:
mode
- mode of simplificationcc
- compilation context- Returns:
- simplified or original expression
- Throws:
QueryException
- query exception- See Also:
CompileContext.Simplify
-
optimizePos
public final Expr optimizePos(CmpV.OpV op, CompileContext cc)
Description copied from class:Expr
- Overrides:
optimizePos
in classExpr
- Parameters:
op
- comparison operatorcc
- compilation context- Returns:
- boolean result, optimized or original expression
-
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.
-
toString
public final void toString(QueryString qs)
Description copied from class:ExprInfo
Creates a query string.
-
-