Class CollatingFunctionFixed

All Implemented Interfaces:
Callable, StatefulSystemFunction, FunctionItem, GroundedValue, Item, Sequence
Direct Known Subclasses:
AllDifferent, AllEqual, CollationKeyFn, Compare, Contains, ContainsToken, DeepEqual, DistinctValues, DuplicateValues, EndsWith, IndexOf, Minimax, StartsWith, SubstringAfter, SubstringBefore

public abstract class CollatingFunctionFixed extends SystemFunction implements StatefulSystemFunction
Abstract superclass for functions that take an optional collation argument, in which the collation is not present as an explicit argument, either because it was defaulted in the original function call, or because it has been bound during static analysis.
  • Constructor Details

    • CollatingFunctionFixed

      public CollatingFunctionFixed()
  • Method Details

    • isSubstringMatchingFunction

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

      public StringCollator getStringCollator()
      Get the collation if known statically, as a StringCollator object
      Returns:
      a StringCollator. Return null if the collation is not known statically.
    • setRetainedStaticContext

      public void setRetainedStaticContext(RetainedStaticContext retainedStaticContext)
      Description copied from class: SystemFunction
      Set the static context in which the function operates, for use with functions whose result depends on the static context
      Overrides:
      setRetainedStaticContext in class SystemFunction
      Parameters:
      retainedStaticContext - the retained static context
    • setCollationName

      public void setCollationName(String collationName) throws XPathException
      Throws:
      XPathException
    • preAllocateComparer

      protected void preAllocateComparer(AtomicType type0, AtomicType type1, StaticContext env)
      During static analysis, if types are known and the collation is known, pre-allocate a comparer for comparing atomic values. Called by some collating functions during type-checking. The comparer that is allocated treats NaN as not equal to NaN.
      Parameters:
      type0 - the type of the first comparand
      type1 - the type of the second comparand
      env - the static context
    • getPreAllocatedAtomicComparer

      public AtomicComparer getPreAllocatedAtomicComparer()
      Get the pre-allocated atomic comparer, if available
      Returns:
      the preallocated atomic comparer, or null
    • getAtomicComparer

      public AtomicComparer getAtomicComparer(XPathContext context)
      During evaluation, get the pre-allocated atomic comparer if available, or allocate a new one otherwise
      Parameters:
      context - the dynamic evaluation context
      Returns:
      the pre-allocated comparer if one is available; otherwise, a newly allocated one, using the specified StringCollator for comparing strings
    • exportAttributes

      public void exportAttributes(ExpressionPresenter out)
      Description copied from class: SystemFunction
      Export any context attributes held within the SystemFunction object. The implementation will normally make one or more calls on out.emitAttribute(name, value).
      Overrides:
      exportAttributes in class SystemFunction
      Parameters:
      out - the export destination
    • importAttributes

      public void importAttributes(Properties attributes) throws XPathException
      Description copied from class: SystemFunction
      Import any attributes found in the export file, that is, any attributes output using the exportAttributes method
      Overrides:
      importAttributes in class SystemFunction
      Parameters:
      attributes - the attributes, as a properties object
      Throws:
      XPathException - if errors are found in the SEF file
    • copy

      public CollatingFunctionFixed copy()
      Make a copy of this SystemFunction. This is required only for system functions such as regex functions that maintain state on behalf of a particular caller.
      Specified by:
      copy in interface StatefulSystemFunction
      Returns:
      a copy of the system function able to contain its own copy of the state on behalf of the caller.