Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xpath.operations
Class Variable

    java.lang.Object
      |
      +--org.apache.xpath.Expression
            |
            +--org.apache.xpath.operations.Variable

Direct Known Subclasses:
  VariableSafeAbsRef

public class Variable
extends Expression
implements PathComponent

The variable reference expression executer.

See Also:
  Serialized Form

Constructor Summary
`Variable()`

Method Summary
`void` | `callVisitors(ExpressionOwner owner, XPathVisitor visitor)`
`boolean` | `deepEquals(Expression expr)`
`XObject` | `execute(XPathContext xctxt)` Execute an expression in the XPath runtime context, and return the result of the expression.
`XObject` | `execute(XPathContext xctxt, boolean destructiveOK)` Dereference the variable, and return the reference value.
`void` | `fixupVariables(java.util.Vector vars, int globalsSize)` This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.
`int` | `getAnalysisBits()` Get the analysis bits for this walker, as defined in the WalkerFactory.
`ElemVariable` | `getElemVariable()` Get the XSLT ElemVariable that this sub-expression references.
`boolean` | `getGlobal()` Set the index for the variable into the stack.
`int` | `getIndex()` Set the index for the variable into the stack.
`QName` | `getQName()` Get the qualified name of the variable.
`boolean` | `isPsuedoVarRef()` Tell if this is a psuedo variable reference, declared by Xalan instead of by the user.
`boolean` | `isStableNumber()` Tell if this expression returns a stable number that will not change during iterations within the expression.
`void` | `setIndex(int index)` Set the index for the variable into the stack.
`void` | `setIsGlobal(boolean isGlobal)` Set whether or not this is a global reference.
`void` | `setQName(QName qname)` Set the qualified name of the variable.

Methods inherited from class org.apache.xpath.Expression
`asIterator, asIteratorRaw, asNode, assertion, bool, canTraverseOutsideSubtree, error, execute, execute, executeCharsToContentHandler, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isNodesetExpr, num, warn, xstr`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Variable

    public Variable()

Method Detail

### setIndex

    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` - a global or local index.

### getIndex

    public int getIndex()

  Set the index for the variable into the stack. For advanced use only.
  Returns:
    index a global or local index.

### setIsGlobal

    public void setIsGlobal(boolean isGlobal)

  Set whether or not this is a global reference. For advanced use only.
  Parameters:
    `isGlobal` - true if this should be a global variable reference.

### getGlobal

    public boolean getGlobal()

  Set the index for the variable into the stack. For advanced use only.
  Returns:
    true if this should be a global variable reference.

### fixupVariables

    public void fixupVariables(java.util.Vector vars,
                               int globalsSize)

  This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time.
  Parameters:
    `vars` - 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).
  Overrides:
    fixupVariables in class Expression

### setQName

    public void setQName(QName qname)

  Set the qualified name of the variable.
  Parameters:
    `qname` - Must be a non-null reference to a qualified name.

### getQName

    public QName getQName()

  Get the qualified name of the variable.
  Returns:
    A non-null reference to a qualified name.

### execute

    public XObject execute(XPathContext xctxt)
                    throws TransformerException

  Execute an expression in the XPath runtime context, and return the result of the expression.
  Parameters:
    `xctxt` - The XPath runtime context.
  Returns:
    The result of the expression in the form of a `XObject`.
  Throws:
    TransformerException - if a runtime exception occurs.
  Overrides:
    execute in class Expression

### execute

    public XObject execute(XPathContext xctxt,
                           boolean destructiveOK)
                    throws TransformerException

  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` - The runtime execution context.
  Returns:
    The evaluated variable, or an empty nodeset if not found.
  Throws:
    TransformerException -
  Overrides:
    execute in class Expression

### getElemVariable

    public ElemVariable getElemVariable()

  Get the XSLT ElemVariable that this sub-expression references. In order for this to work, the SourceLocator must be the owning ElemTemplateElement.
  Returns:
    The dereference to the ElemVariable, or null if not found.

### isStableNumber

    public boolean 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:
    true if the expression represents a stable number.
  Overrides:
    isStableNumber in class Expression

### getAnalysisBits

    public int getAnalysisBits()

  Get the analysis bits for this walker, as defined in the WalkerFactory.
  Specified by:
    getAnalysisBits in interface PathComponent
  Returns:
    One of WalkerFactory#BIT_DESCENDANT, etc.

### callVisitors

    public void callVisitors(ExpressionOwner owner,
                             XPathVisitor visitor)

  See Also:
    `XPathVisitable.callVisitors(ExpressionOwner, XPathVisitor)`

### deepEquals

    public boolean deepEquals(Expression expr)

  Overrides:
    deepEquals in class Expression
  See Also:
    `Expression.deepEquals(Expression)`

### isPsuedoVarRef

    public boolean isPsuedoVarRef()

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 Apache XML Project. All Rights Reserved.