com.caucho.xpath.expr
Class StringExpr

java.lang.Object
  extended by com.caucho.xpath.Expr
      extended by com.caucho.xpath.expr.StringExpr

public class StringExpr
extends Expr

Implements the builtin XPath string expressions.


Field Summary
 
Fields inherited from class com.caucho.xpath.Expr
ADD, AND, ATTRIBUTE, BASE_URI, BOOLEAN, BOOLEAN_EQ, BOOLEAN_NEQ, CEILING, CONCAT, CONST, CONTAINS, COUNT, DIV, ELEMENT, EQ, FALSE, FLOOR, FORMAT_NUMBER, FUNCTION_AVAILABLE, GE, GENERATE_ID, GT, ID, IF, LANG, LAST, LAST_FUN, LE, LOCAL_PART, LT, MOD, MUL, NAMESPACE, NEG, NEQ, NODE_SET, NORMALIZE, NOT, NUMBER, NUMBER_EQ, NUMBER_GE, NUMBER_GT, NUMBER_LE, NUMBER_LT, NUMBER_NEQ, OR, POSITION, QNAME, QUO, ROUND, SELF, SELF_NAME, STARTS_WITH, STRING, STRING_EQ, STRING_LENGTH, STRING_NEQ, SUB, SUBSTRING, SUBSTRING_AFTER, SUBSTRING_BEFORE, SUM, SYSTEM_PROPERTY, TRANSLATE, TRUE
 
Constructor Summary
StringExpr(int code, java.util.ArrayList args)
          Creates a string expression from a list of arguments.
StringExpr(int code, Expr expr)
           
StringExpr(int code, Expr left, Expr right)
           
StringExpr(int code, Expr left, Expr right, Expr third)
          Create a StringExpression with three arguments.
StringExpr(java.lang.String value)
           
 
Method Summary
 boolean evalBoolean(org.w3c.dom.Node node, ExprEnvironment env)
          Evaluate the expression as a boolean, i.e.
 double evalNumber(org.w3c.dom.Node node, ExprEnvironment env)
          Evaluate the expression as a double, i.e.
 java.lang.Object evalObject(org.w3c.dom.Node node, ExprEnvironment env)
          Evaluate the expression as an object, i.e.
 java.lang.String evalString(org.w3c.dom.Node node, ExprEnvironment env)
          Evaluates the expression as an string.
 java.lang.String getValue()
           
 boolean isString()
          The StringExpr returns a string value.
 java.lang.String toString()
          Return the expression as a string.
 
Methods inherited from class com.caucho.xpath.Expr
addParam, addVar, evalBoolean, evalNodeSet, evalNodeSet, evalNumber, evalObject, evalString, evalString, evalString, evalVar, getListContext, isBoolean, isNodeSet, isNumber, setListContext, setVar, stringToNumber, toBoolean, toDouble, toNode, toNodeList, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringExpr

public StringExpr(int code,
                  Expr left,
                  Expr right,
                  Expr third)
Create a StringExpression with three arguments.

Parameters:
code - the Expr code of the expression.
left - the first argument.
right - the second argument.
third - the third argument.

StringExpr

public StringExpr(int code,
                  Expr left,
                  Expr right)

StringExpr

public StringExpr(int code,
                  Expr expr)

StringExpr

public StringExpr(java.lang.String value)

StringExpr

public StringExpr(int code,
                  java.util.ArrayList args)
Creates a string expression from a list of arguments.

Parameters:
code - Expr code for the function.
args - array list of the arguments.
Method Detail

isString

public boolean isString()
The StringExpr returns a string value.

Overrides:
isString in class Expr

getValue

public java.lang.String getValue()

evalString

public java.lang.String evalString(org.w3c.dom.Node node,
                                   ExprEnvironment env)
                            throws XPathException
Evaluates the expression as an string.

Specified by:
evalString in class Expr
Parameters:
node - the current node
env - the variable environment.
Returns:
the string representation of the expression.
Throws:
XPathException

evalBoolean

public boolean evalBoolean(org.w3c.dom.Node node,
                           ExprEnvironment env)
                    throws XPathException
Evaluate the expression as a boolean, i.e. evaluate it as a string and then convert it to a boolean.

Specified by:
evalBoolean in class Expr
Parameters:
node - the current node
env - the variable environment.
Returns:
the boolean representation of the expression.
Throws:
XPathException

evalNumber

public double evalNumber(org.w3c.dom.Node node,
                         ExprEnvironment env)
                  throws XPathException
Evaluate the expression as a double, i.e. evaluate it as a string and then convert it to a double.

Specified by:
evalNumber in class Expr
Parameters:
node - the current node
env - the variable environment.
Returns:
the numeric representation of the expression.
Throws:
XPathException

evalObject

public java.lang.Object evalObject(org.w3c.dom.Node node,
                                   ExprEnvironment env)
                            throws XPathException
Evaluate the expression as an object, i.e. return the string value.

Specified by:
evalObject in class Expr
Parameters:
node - the current node
env - the variable environment.
Returns:
the boolean representation of the expression.
Throws:
XPathException

toString

public java.lang.String toString()
Return the expression as a string. toString() returns a valid XPath expression. This lets applications like XSLT use toString() to print the string in the generated Java.

Overrides:
toString in class java.lang.Object