Class StartsWith

All Implemented Interfaces:
Callable, StatefulSystemFunction, Function, GroundedValue, Item, Sequence

public class StartsWith extends CollatingFunctionFixed
Implements the fn:starts-with() function, with the collation already known
  • Constructor Details

    • StartsWith

      public StartsWith()
  • Method Details

    • isSubstringMatchingFunction

      public boolean isSubstringMatchingFunction()
      Description copied from class: CollatingFunctionFixed
      Ask whether this function needs a collation that can handle substring matching
      Overrides:
      isSubstringMatchingFunction in class CollatingFunctionFixed
      Returns:
      true in the case of functions such as contains() and starts-with() where substring matching is required. Returns false by default;
    • makeOptimizedFunctionCall

      public Expression makeOptimizedFunctionCall(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression... arguments) throws XPathException
      Allow the function to create an optimized call based on the values of the actual arguments
      Overrides:
      makeOptimizedFunctionCall in class SystemFunction
      Parameters:
      visitor - the expression visitor
      contextInfo - information about the context item
      arguments - the supplied arguments to the function call. Note: modifying the contents of this array should not be attempted, it is likely to have no effect.
      Returns:
      either a function call on this function, or an expression that delivers the same result, or null indicating that no optimization has taken place
      Throws:
      XPathException - if an error is detected
    • startsWith

      public static boolean startsWith(StringValue arg0, StringValue arg1, SubstringMatcher collator)
    • call

      public BooleanValue call(XPathContext context, Sequence[] arguments) throws XPathException
      Evaluate the function
      Parameters:
      context - the XPath dynamic evaluation context
      arguments - the actual arguments to be supplied
      Returns:
      the result of invoking the function
      Throws:
      XPathException - if a dynamic error occurs within the function
    • getCompilerName

      public String getCompilerName()
      Description copied from class: SystemFunction
      Get the (local) name of a class that can be used to generate bytecode for this system function
      Overrides:
      getCompilerName in class SystemFunction
      Returns:
      the name of a bytecode generation class, or null if there is no bytecode support for this function