APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal.operations

public Class Variable

extends Expression
implements PathComponent
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xpath.internal.axes.PathComponent
Known Direct Subclasses
com.sun.org.apache.xpath.internal.operations.VariableSafeAbsRef
Imports
com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xml.internal.utils.QName, com.sun.org.apache.xpath.internal.Expression, .ExpressionOwner, .XPathContext, .XPathVisitor, com.sun.org.apache.xpath.internal.axes.PathComponent, .WalkerFactory, com.sun.org.apache.xpath.internal.objects.XNodeSet, .XObject, com.sun.org.apache.xpath.internal.res.XPATHErrorResources, java.util.List, javax.xml.transform.TransformerException

The variable reference expression executer.

Field Summary

Modifier and TypeField and Description
private boolean
m_fixUpWasCalled

Tell if fixupVariables was called.

protected int
m_index

The index of the variable, which is either an absolute index to a global, or, if higher than the globals area, must be adjusted by adding the offset to the current stack frame.

protected boolean
protected QName
m_qname

The qualified name of the variable.

pack-priv static final String
pack-priv static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member.

public boolean
deepEquals(Expression expr)

Implements abstract com.sun.org.apache.xpath.internal.Expression.deepEquals.

Compare this object with another object and see if they are equal, include the sub heararchy.

public XObject

Returns:

The result of the expression in the form of a XObject.
execute
(XPathContext
The XPath runtime context.
xctxt
)

Implements abstract com.sun.org.apache.xpath.internal.Expression.execute.

Execute an expression in the XPath runtime context, and return the result of the expression.

public XObject

Returns:

The evaluated variable, or an empty nodeset if not found.
execute
(XPathContext
The runtime execution context.
xctxt
,
boolean destructiveOK)

Overrides com.sun.org.apache.xpath.internal.Expression.execute.

Dereference the variable, and return the reference value.

public void
fixupVariables(List<QName>
List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).
vars
,
int globalsSize)

Implements abstract com.sun.org.apache.xpath.internal.Expression.fixupVariables.

This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.

public int

Returns:

One of WalkerFactory#BIT_DESCENDANT, etc.
getAnalysisBits
()

Implements com.sun.org.apache.xpath.internal.axes.PathComponent.getAnalysisBits.

Get the analysis bits for this walker, as defined in the WalkerFactory.

public boolean

Returns:

true if this should be a global variable reference.
getGlobal
()

Set the index for the variable into the stack.

public int

Returns:

index a global or local index.
getIndex
()

Set the index for the variable into the stack.

public QName

Returns:

A non-null reference to a qualified name.
getQName
()

Get the qualified name of the variable.

public boolean
isPsuedoVarRef()

Tell if this is a psuedo variable reference, declared by Xalan instead of by the user.

public boolean

Returns:

true if the expression represents a stable number.
isStableNumber
()

Overrides com.sun.org.apache.xpath.internal.Expression.isStableNumber.

Tell if this expression returns a stable number that will not change during iterations within the expression.

public void
setIndex(int
a global or local index.
index
)

Set the index for the variable into the stack.

public void
setIsGlobal(boolean
true if this should be a global variable reference.
isGlobal
)

Set whether or not this is a global reference.

public void
setQName(QName
Must be a non-null reference to a qualified name.
qname
)

Set the qualified name of the variable.

Inherited from com.sun.org.apache.xpath.internal.Expression:
asIteratorasIteratorRawasNodeassertionboolcanTraverseOutsideSubtreeerrorexecuteexecuteexecuteCharsToContentHandlerexprAddChildexprGetChildexprGetNumChildrenexprGetParentexprSetParentgetColumnNumbergetExpressionOwnergetLineNumbergetPublicIdgetSystemIdisNodesetExprisSameClassnumwarnxstr

Field Detail

m_fixUpWasCalledback to summary
private boolean m_fixUpWasCalled

Tell if fixupVariables was called.

m_indexback to summary
protected int m_index

The index of the variable, which is either an absolute index to a global, or, if higher than the globals area, must be adjusted by adding the offset to the current stack frame.

m_isGlobalback to summary
protected boolean m_isGlobal
m_qnameback to summary
protected QName m_qname

The qualified name of the variable.

PSUEDOVARNAMESPACEback to summary
pack-priv static final String PSUEDOVARNAMESPACE
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xpath.internal.Expression.serialVersionUID.

Constructor Detail

Variableback to summary
public Variable()

Method Detail

callVisitorsback to summary
public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

Doc from com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

See Also
com.sun.org.apache.xpath.internal.XPathVisitable#callVisitors(ExpressionOwner, XPathVisitor)
deepEqualsback to summary
public boolean deepEquals(Expression expr)

Implements abstract com.sun.org.apache.xpath.internal.Expression.deepEquals.

Doc from com.sun.org.apache.xpath.internal.Expression.deepEquals.

Compare this object with another object and see if they are equal, include the sub heararchy.

See Also
Expression#deepEquals(Expression)
executeback to summary
public XObject execute(XPathContext xctxt) throws TransformerException

Implements abstract com.sun.org.apache.xpath.internal.Expression.execute.

Execute an expression in the XPath runtime context, and return the result of the expression.

Parameters
xctxt:XPathContext

The XPath runtime context.

Returns:XObject

The result of the expression in the form of a XObject.

Exceptions
TransformerException:
if a runtime exception occurs.
executeback to summary
public XObject execute(XPathContext xctxt, boolean destructiveOK) throws TransformerException

Overrides com.sun.org.apache.xpath.internal.Expression.execute.

Dereference the variable, and return the reference value. Note that lazy evaluation will occur. If a variable within scope is not found, a warning will be sent to the error listener, and an empty nodeset will be returned.

Parameters
xctxt:XPathContext

The runtime execution context.

Returns:XObject

The evaluated variable, or an empty nodeset if not found.

Exceptions
TransformerException:

Doc from com.sun.org.apache.xpath.internal.Expression.execute.

if a runtime exception occurs.

fixupVariablesback to summary
public void fixupVariables(List<QName> vars, int globalsSize)

Implements abstract com.sun.org.apache.xpath.internal.Expression.fixupVariables.

This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.

Parameters
vars:List<QName>

List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).

getAnalysisBitsback to summary
public int getAnalysisBits()

Implements com.sun.org.apache.xpath.internal.axes.PathComponent.getAnalysisBits.

Get the analysis bits for this walker, as defined in the WalkerFactory.

Returns:int

One of WalkerFactory#BIT_DESCENDANT, etc.

getGlobalback to summary
public boolean getGlobal()

Set the index for the variable into the stack. For advanced use only.

Returns:boolean

true if this should be a global variable reference.

getIndexback to summary
public int getIndex()

Set the index for the variable into the stack. For advanced use only.

Returns:int

index a global or local index.

getQNameback to summary
public QName getQName()

Get the qualified name of the variable.

Returns:QName

A non-null reference to a qualified name.

isPsuedoVarRefback to summary
public boolean isPsuedoVarRef()

Tell if this is a psuedo variable reference, declared by Xalan instead of by the user.

isStableNumberback to summary
public boolean isStableNumber()

Overrides com.sun.org.apache.xpath.internal.Expression.isStableNumber.

Tell if this expression returns a stable number that will not change during iterations within the expression. This is used to determine if a proximity position predicate can indicate that no more searching has to occur.

Returns:boolean

true if the expression represents a stable number.

setIndexback to summary
public void setIndex(int index)

Set the index for the variable into the stack. For advanced use only. You must know what you are doing to use this.

Parameters
index:int

a global or local index.

setIsGlobalback to summary
public void setIsGlobal(boolean isGlobal)

Set whether or not this is a global reference. For advanced use only.

Parameters
isGlobal:boolean

true if this should be a global variable reference.

setQNameback to summary
public void setQName(QName qname)

Set the qualified name of the variable.

Parameters
qname:QName

Must be a non-null reference to a qualified name.