org.jaxen
Class Context

java.lang.Object
  extended byorg.jaxen.Context
All Implemented Interfaces:
java.io.Serializable

public class Context
extends java.lang.Object
implements java.io.Serializable

Wrapper around implementation-specific objects used as the context of an expression evaluation.

NOTE: This class is not typically used directly, but is exposed for writers of implementation-specific XPath packages.

The Context bundles utilities together for evaluation of the expression. It wraps the provided objects for ease-of-passage through the expression AST.

Author:
bob mcwhirter
See Also:
ContextSupport, BaseXPath, XPath for dom4j, XPath for JDOM, XPath for W3C DOM, Serialized Form

Field Summary
private  ContextSupport contextSupport
          Context-support.
private  java.util.List nodeSet
          Context node-set.
private  int position
          Current context position.
private  int size
          Current context size.
 
Constructor Summary
Context(ContextSupport contextSupport)
          Construct.
 
Method Summary
 Context duplicate()
          Create a type-safe shallow copy.
 ContextSupport getContextSupport()
          Retrieve the ContextSupport.
 Function getFunction(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName)
          Retrieve a Function.
 Navigator getNavigator()
          Retrieve the current Navigator.
 java.util.List getNodeSet()
          Retrieve the context node-set.
 int getPosition()
          Retrieve current position in the context node-set.
 int getSize()
          Retrieve the size of the context node-set.
 java.lang.Object getVariableValue(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName)
          Retrieve a variable value.
 void setContextSupport(ContextSupport contextSupport)
          Set the ContextSupport.
 void setNodeSet(java.util.List nodeSet)
          Set the context node-set.
 void setPosition(int position)
          Set the current position in the context node-set.
 void setSize(int size)
          Set the current size in the context node-set.
 java.lang.String translateNamespacePrefixToUri(java.lang.String prefix)
          Translate a namespace prefix to its URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contextSupport

private ContextSupport contextSupport
Context-support.


nodeSet

private java.util.List nodeSet
Context node-set.


size

private int size
Current context size.


position

private int position
Current context position.

Constructor Detail

Context

public Context(ContextSupport contextSupport)
Construct.

Parameters:
contextSupport - The context-support.
Method Detail

setNodeSet

public void setNodeSet(java.util.List nodeSet)
Set the context node-set.

Parameters:
nodeSet - The context node-set.

getNodeSet

public java.util.List getNodeSet()
Retrieve the context node-set.

Returns:
The context node-set.

setContextSupport

public void setContextSupport(ContextSupport contextSupport)
Set the ContextSupport.

Parameters:
contextSupport - The context-support.

getContextSupport

public ContextSupport getContextSupport()
Retrieve the ContextSupport.

Returns:
The context-support.

getNavigator

public Navigator getNavigator()
Retrieve the current Navigator.

Returns:
The navigator.

translateNamespacePrefixToUri

public java.lang.String translateNamespacePrefixToUri(java.lang.String prefix)
Translate a namespace prefix to its URI.

Parameters:
prefix - The prefix.
Returns:
The naemspace URI mapped to the prefix.

getVariableValue

public java.lang.Object getVariableValue(java.lang.String namespaceURI,
                                         java.lang.String prefix,
                                         java.lang.String localName)
                                  throws UnresolvableException
Retrieve a variable value.

Parameters:
namespaceURI - The function namespace URI.
prefix - The function prefix.
localName - The function name.
Returns:
The variable value.
Throws:
UnresolvableException - If unable to locate a bound variable.

getFunction

public Function getFunction(java.lang.String namespaceURI,
                            java.lang.String prefix,
                            java.lang.String localName)
                     throws UnresolvableException
Retrieve a Function.

Parameters:
namespaceURI - The function namespace URI.
prefix - The function prefix.
localName - The function name.
Returns:
The function object.
Throws:
UnresolvableException - If unable to locate a bound function.

setSize

public void setSize(int size)
Set the current size in the context node-set.

Parameters:
size - The size.

getSize

public int getSize()
Retrieve the size of the context node-set.

Returns:
The size.

setPosition

public void setPosition(int position)
Set the current position in the context node-set.

Parameters:
position - The position

getPosition

public int getPosition()
Retrieve current position in the context node-set.

Returns:
The current position.

duplicate

public Context duplicate()
Create a type-safe shallow copy.

Returns:
The duplicate.