com.caucho.xpath
Class Expr

java.lang.Object
  |
  +--com.caucho.xpath.Expr

public abstract class Expr
extends java.lang.Object

Compute values from nodes. Because the expressions themselves are untyped, the class provides methods for creating the type of the desired result.


Method Summary
 boolean evalBoolean(Node node)
          Returns the boolean value of the node.
 boolean evalBoolean(Node node, Env env)
          Returns the boolean value of the node.
 java.util.Iterator evalNodeSet(Node node)
          Returns an iterator of matching nodes
 java.util.Iterator evalNodeSet(Node node, Env env)
          Returns an iterator of matching nodes
 double evalNumber(Node node)
          Returns the numeric value of the node.
 double evalNumber(Node node, Env env)
          Returns the numeric value of the node.
 java.lang.Object evalObject(Node node)
          Returns the object value of the node.
 java.lang.Object evalObject(Node node, Env env)
          Returns the object value of the node.
 java.lang.String evalString(Node node)
          Returns the string value of the node.
 java.lang.String evalString(Node node, Env env)
          Returns the string value of the node.
 Pattern getListContext()
           
 boolean isBoolean()
          true if the expression prefers to return a boolean.
 boolean isNodeSet()
          true if the expression prefers to return a node set.
 boolean isNumber()
          true if the expression prefers to return a number.
 boolean isString()
          true if the expression prefers to return a string.
 void setListContext(Pattern listContext)
           
static boolean toBoolean(java.lang.Object value)
          Convert a Java object to a boolean using the XPath rules.
static double toDouble(java.lang.Object value)
          Convert a Java object to a double using the XPath rules.
static Node toNode(java.lang.Object value)
          Convert a Java object to a node using the XPath rules.
static java.lang.String toString(java.lang.Object value)
          Convert a Java object to a string using the XPath rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setListContext

public void setListContext(Pattern listContext)

getListContext

public Pattern getListContext()

evalNumber

public double evalNumber(Node node)
Returns the numeric value of the node.
Parameters:
node - the node to evaluate and use as a context

evalNumber

public double evalNumber(Node node,
                         Env env)
Returns the numeric value of the node.
Parameters:
node - the node to evaluate and use as a context
env - variable environment.

evalBoolean

public boolean evalBoolean(Node node)
Returns the boolean value of the node.
Parameters:
node - the node to evaluate and use as a context

evalBoolean

public boolean evalBoolean(Node node,
                           Env env)
Returns the boolean value of the node.
Parameters:
node - the node to evaluate and use as a context
env - variable environment.

evalString

public java.lang.String evalString(Node node)
Returns the string value of the node.
Parameters:
node - the node to evaluate and use as a context

evalString

public java.lang.String evalString(Node node,
                                   Env env)
Returns the string value of the node.
Parameters:
node - the node to evaluate and use as a context
env - variable environment.

evalObject

public java.lang.Object evalObject(Node node)
Returns the object value of the node.
Parameters:
node - the node to evaluate and use as a context

evalObject

public java.lang.Object evalObject(Node node,
                                   Env env)
Returns the object value of the node.
Parameters:
node - the node to evaluate and use as a context
env - variable environment.

evalNodeSet

public java.util.Iterator evalNodeSet(Node node)
Returns an iterator of matching nodes
Parameters:
node - the node to evaluate and use as a context

evalNodeSet

public java.util.Iterator evalNodeSet(Node node,
                                      Env env)
Returns an iterator of matching nodes
Parameters:
node - the node to evaluate and use as a context
env - variable environment.

isNumber

public boolean isNumber()
true if the expression prefers to return a number.

isBoolean

public boolean isBoolean()
true if the expression prefers to return a boolean.

isString

public boolean isString()
true if the expression prefers to return a string.

isNodeSet

public boolean isNodeSet()
true if the expression prefers to return a node set.

toBoolean

public static boolean toBoolean(java.lang.Object value)
Convert a Java object to a boolean using the XPath rules.

toDouble

public static double toDouble(java.lang.Object value)
Convert a Java object to a double using the XPath rules.

toString

public static java.lang.String toString(java.lang.Object value)
Convert a Java object to a string using the XPath rules.

toNode

public static Node toNode(java.lang.Object value)
Convert a Java object to a node using the XPath rules.