Class ComparisonFunctions

java.lang.Object
dev.metaschema.core.metapath.function.ComparisonFunctions

public final class ComparisonFunctions extends Object
A collection of comparison functions supporting value and general comparisons.

Based on the XPath 3.1 comparison expressions syntax.

  • Method Details

    • valueCompairison

      @NonNull public static IBooleanItem valueCompairison(@NonNull IAnyAtomicItem leftItem, @NonNull ComparisonFunctions.Operator operator, @NonNull IAnyAtomicItem rightItem, @Nullable DynamicContext dynamicContext)
      Compare the two items using the provided operator.
      Parameters:
      leftItem - the first item to compare
      operator - the comparison operator
      rightItem - the second item to compare
      dynamicContext - used to get the implicit timezone from the evaluation context
      Returns:
      the result of the comparison
    • generalComparison

      @NonNull public static IBooleanItem generalComparison(@NonNull ISequence<? extends IAnyAtomicItem> leftItems, @NonNull ComparisonFunctions.Operator operator, @NonNull ISequence<? extends IAnyAtomicItem> rightItems, @NonNull DynamicContext dynamicContext)
      Compare the sets of atomic items.
      Parameters:
      leftItems - the first set of items to compare
      operator - the comparison operator
      rightItems - the second set of items to compare
      dynamicContext - used to get the implicit timezone from the evaluation context
      Returns:
      a or an empty ISequence if either item is null
    • compare

      @NonNull public static IBooleanItem compare(@NonNull IAnyAtomicItem left, @NonNull ComparisonFunctions.Operator operator, @NonNull IAnyAtomicItem right, @Nullable DynamicContext dynamicContext)
      Compare the right item with the left item using the specified operator.
      Parameters:
      left - the value to compare against
      operator - the comparison operator
      right - the value to compare with
      dynamicContext - used to get the implicit timezone from the evaluation context
      Returns:
      the comparison result
    • stringCompare

      @NonNull public static IBooleanItem stringCompare(@NonNull IStringItem left, @NonNull ComparisonFunctions.Operator operator, @NonNull IStringItem right)
      Perform a string-based comparison of the right item against the left item using the specified operator.
      Parameters:
      left - the value to compare against
      operator - the comparison operator
      right - the value to compare with
      Returns:
      the comparison result
    • numericCompare

      @NonNull public static IBooleanItem numericCompare(@NonNull INumericItem left, @NonNull ComparisonFunctions.Operator operator, @NonNull INumericItem right)
      Perform a number-based comparison of the right item against the left item using the specified operator.
      Parameters:
      left - the value to compare against
      operator - the comparison operator
      right - the value to compare with
      Returns:
      the comparison result
    • booleanCompare

      @NonNull public static IBooleanItem booleanCompare(@NonNull IBooleanItem left, @NonNull ComparisonFunctions.Operator operator, @NonNull IBooleanItem right)
      Perform a boolean-based comparison of the right item against the left item using the specified operator.
      Parameters:
      left - the value to compare against
      operator - the comparison operator
      right - the value to compare with
      Returns:
      the comparison result
    • dateTimeCompare

      @NonNull public static IBooleanItem dateTimeCompare(@NonNull IDateTimeItem left, @NonNull ComparisonFunctions.Operator operator, @NonNull IDateTimeItem right, @Nullable DynamicContext dynamicContext)
      Perform a date and time-based comparison of the right item against the left item using the specified operator.
      Parameters:
      left - the value to compare against
      operator - the comparison operator
      right - the value to compare with
      dynamicContext - used to get the implicit timezone from the evaluation context
      Returns:
      the comparison result
    • durationCompare

      @NonNull public static IBooleanItem durationCompare(@NonNull IDurationItem left, @NonNull ComparisonFunctions.Operator operator, @NonNull IDurationItem right)
      Perform a duration-based comparison of the right item against the left item using the specified operator.
      Parameters:
      left - the value to compare against
      operator - the comparison operator
      right - the value to compare with
      Returns:
      the comparison result
    • binaryCompare

      @NonNull public static IBooleanItem binaryCompare(@NonNull IBase64BinaryItem left, @NonNull ComparisonFunctions.Operator operator, @NonNull IBase64BinaryItem right)
      Perform a binary data-based comparison of the right item against the left item using the specified operator.
      Parameters:
      left - the value to compare against
      operator - the comparison operator
      right - the value to compare with
      Returns:
      the comparison result