com.icl.saxon.functions
Class Substring

java.lang.Object
  |
  +--com.icl.saxon.expr.Expression
        |
        +--com.icl.saxon.expr.Function
              |
              +--com.icl.saxon.functions.Substring

public class Substring
extends Function


Fields inherited from class com.icl.saxon.expr.Function
arguments
 
Fields inherited from class com.icl.saxon.expr.Expression
emptyVector, staticContext
 
Constructor Summary
Substring()
           
 
Method Summary
 Value eval(java.util.Vector args, Context context)
          Evaluate the function
 int getDataType()
          Determine the data type of the expression, if possible
 java.lang.String getName()
          Get the name of the function.
 Expression simplify()
          Simplify This is a pure function so it can be simplified in advance if the arguments are known
static java.lang.String substring(java.lang.String s, double start)
          Implement substring function.
static java.lang.String substring(java.lang.String s, double start, double len)
          Implement substring function.
 
Methods inherited from class com.icl.saxon.expr.Function
addArgument, checkArgumentCount, evaluate, getDependencies, getIntrinsicDependencies, newInstance, reduce, reduceIntrinsic, simplifyPureFunction, toString
 
Methods inherited from class com.icl.saxon.expr.Expression
containsReferences, enumerate, evaluateAsBoolean, evaluateAsNodeSet, evaluateAsNumber, evaluateAsString, getStaticContext, isNumeric, isRelative, make, make, setStaticContext, usesCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Substring

public Substring()
Method Detail

getName

public java.lang.String getName()
Description copied from class: Function
Get the name of the function. This method must be implemented in all subclasses.
Overrides:
getName in class Function
Following copied from class: com.icl.saxon.expr.Function
Returns:
the name of the function, as used in XSL expressions, but excluding its namespace prefix

getDataType

public int getDataType()
Determine the data type of the expression, if possible
Overrides:
getDataType in class Expression
Returns:
Value.STRING

eval

public Value eval(java.util.Vector args,
                  Context context)
           throws org.xml.sax.SAXException
Evaluate the function
Overrides:
eval in class Function
Following copied from class: com.icl.saxon.expr.Function
Parameters:
arguments - A Vector, each of whose elements is a Value containing the value of a supplied argument to the function.
context - The context in which the function is to be evaluated
Returns:
a Value representing the result of the function. This must be of the data type corresponding to the result of getType().
Throws:
org.xml.sax.SAXException - if the function cannot be evaluated.

simplify

public Expression simplify()
                    throws org.xml.sax.SAXException
Simplify This is a pure function so it can be simplified in advance if the arguments are known
Overrides:
simplify in class Function
Following copied from class: com.icl.saxon.expr.Function
Returns:
the simplified expression

substring

public static java.lang.String substring(java.lang.String s,
                                         double start)
Implement substring function. This follows the algorithm in the spec precisely.

substring

public static java.lang.String substring(java.lang.String s,
                                         double start,
                                         double len)
Implement substring function. This follows the algorithm in the spec precisely, except that we exit the loop once we've exceeded the required length.