public final class Var extends ExprInfo
Modifier and Type | Field and Description |
---|---|
SeqType |
declType
Declared type,
null if not specified. |
int |
id
Variable ID.
|
InputInfo |
info
Input info.
|
QNm |
name
Variable name.
|
boolean |
promote
Flag for function conversion.
|
Constructor and Description |
---|
Var(QNm name,
SeqType declType,
boolean param,
int slot,
QueryContext qc,
StaticContext sc,
InputInfo info)
Constructor for a variable with an already known stack slot.
|
Var(QNm name,
SeqType declType,
boolean param,
QueryContext qc,
StaticContext sc,
InputInfo info)
Constructor.
|
Var(Var var,
QueryContext qc,
StaticContext sc)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
adoptCheck(SeqType st,
boolean prom)
Tries to adopt the given type check.
|
Expr |
checked(Expr expr,
CompileContext cc)
Returns an equivalent to the given expression that checks this variable's type.
|
boolean |
checksType()
Determines if this variable checks the type of the expression bound to it.
|
void |
checkType(Expr expr)
Checks if the type of the specified expression could be converted to the sequence type
of this variable.
|
Value |
checkType(Value value,
QueryContext qc,
boolean opt)
Checks the type of this value and casts/promotes it when necessary.
|
Data |
data()
Returns the data reference bound to this variable.
|
boolean |
ddo()
Returns the distinct document order flag.
|
SeqType |
declaredType()
Declared type of this variable.
|
boolean |
equals(Object obj) |
void |
expr(Expr expr)
Attaches an input expression.
|
int |
hashCode() |
byte[] |
id()
Returns a unique representation of the variable.
|
boolean |
is(Var var)
Checks whether the given variable is identical to this one, i.e.
|
void |
plan(QueryPlan plan)
Creates a query plan.
|
void |
plan(QueryString qs)
Creates a query string.
|
boolean |
promotes()
Checks if this variable performs function conversion on its bound values.
|
void |
refineType(SeqType st,
CompileContext cc)
Tries to refine the type of this variable through the type of the bound expression.
|
void |
refineType(SeqType st,
long size,
CompileContext cc)
Tries to refine the type of this variable through the type of the bound expression.
|
SeqType |
seqType()
Sequence type of values bound to this variable.
|
long |
size()
Returns the result size.
|
String |
toErrorString()
Returns a string representation of the expression that can be embedded in error messages.
|
description, toString
public final QNm name
public final int id
public final InputInfo info
public SeqType declType
null
if not specified.public boolean promote
public Var(QNm name, SeqType declType, boolean param, int slot, QueryContext qc, StaticContext sc, InputInfo info)
name
- variable namedeclType
- declared type, null
for no checkparam
- function parameter flagslot
- stack slotqc
- query context, used for generating a variable IDsc
- static contextinfo
- input infopublic Var(QNm name, SeqType declType, boolean param, QueryContext qc, StaticContext sc, InputInfo info)
name
- variable namedeclType
- declared sequence type, null
for no checkparam
- function parameter flagqc
- query context, used for generating a variable IDsc
- static contextinfo
- input infopublic Var(Var var, QueryContext qc, StaticContext sc)
var
- variable to copyqc
- query contextsc
- static contextpublic SeqType seqType()
public void expr(Expr expr)
expr
- input expressionpublic long size()
public boolean ddo()
Expr.ddo()
for details.public Data data()
Expr.data()
for details.null
)public SeqType declaredType()
public void refineType(SeqType st, CompileContext cc) throws QueryException
st
- sequence type of the bound expressioncc
- compilation context (can be null
)QueryException
- query exceptionpublic void refineType(SeqType st, long size, CompileContext cc) throws QueryException
st
- sequence type of the bound expressionsize
- size (can be -1
)cc
- compilation context (can be null
)QueryException
- query exceptionpublic boolean checksType()
true
if the type is checked or promoted, false
otherwisepublic Expr checked(Expr expr, CompileContext cc) throws QueryException
expr
- expressioncc
- compilation contextQueryException
- query exceptionpublic Value checkType(Value value, QueryContext qc, boolean opt) throws QueryException
value
- value to be checkedqc
- query contextopt
- if the result should be optimizedQueryException
- if the check failedpublic void checkType(Expr expr) throws QueryException
expr
- expressionQueryException
- query exceptionpublic boolean is(Var var)
var
- variable to checktrue
if the IDs are equal, false
otherwisepublic boolean promotes()
public boolean adoptCheck(SeqType st, boolean prom)
st
- type to checkprom
- if function conversion should be appliedtrue
if the check could be adopted, false
otherwisepublic byte[] id()
public void plan(QueryString qs)
ExprInfo
public String toErrorString()
ExprInfo
ExprInfo.toString()
.toErrorString
in class ExprInfo
Copyright © 2005–2023 BaseX Team. All rights reserved.