Class PrimitivePatterns

java.lang.Object
eu.bandm.tools.paisley.PrimitivePatterns

@Generated(generator="eu.bandm.tools.expander", version="", timestamp="2026-01-12T17:56:35") public abstract class PrimitivePatterns extends Object
Static factory methods for creating patterns for primitive types and basic objects.

All patterns obtainable from this class are deterministic and bind no variables.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Pattern<Double>
    A pattern that matches finite floating-point values.
    static final Pattern<Double>
    A pattern that matches infinite floating-point values.
    static final Pattern<Boolean>
    A pattern that matches the value false.
    static final Pattern<Boolean>
    A pattern that matches the value true.
    static final Pattern<Double>
    A pattern that matches the floating-point value NaN.
    static final Pattern<Double>
    A pattern that matches negative floating-point values.
    static final Pattern<Integer>
    A pattern that matches negative integer values.
    static final Pattern<Double>
    A pattern that matches positive floating-point values.
    static final Pattern<Integer>
    A pattern that matches positive integer values.
    static final Pattern<Double>
    A pattern that matches the floating-point value zero.
    static final Pattern<Integer>
    A pattern that matches the integer value zero.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <A> Pattern<A>
    compare(Comparator<? super A> comparator, A other, Pattern<? super Integer> body)
    Returns a pattern that matches objects based on comparison with a given object using the given ordering.
    static <A extends Comparable<? super A>>
    Pattern<A>
    compareTo(A other, Pattern<? super Integer> body)
    Returns a pattern that matches objects based on comparison with a given object using the natural ordering.
    static <A> Pattern<Optional<A>>
    emptyOr(Pattern<? super A> body)
    Return a pattern that matches an optional value if present.
    static <A> Pattern<A>
    eq(A other)
    Returns a pattern that matches objects identically equal to a given reference.
    static <A> Pattern<A>
    Returns a pattern that matches only the null reference.
    static <A> Pattern<A>
    equal(A other)
    Returns a pattern that matches objects equal to a given reference.
    static <A extends Comparable<? super A>>
    Pattern<A>
    greaterThan(A other)
    Returns a pattern that matches objects greater than a given object using natural ordering.
    static <A> Pattern<A>
    greaterThan(Comparator<? super A> comparator, A other)
    Returns a pattern that matches objects greater than a given object using the given ordering.
    static <A extends Comparable<? super A>>
    Pattern<A>
    Returns a pattern that matches objects greater than or equal to a given object using natural ordering.
    static <A> Pattern<A>
    greaterThanOrEqual(Comparator<? super A> comparator, A other)
    Returns a pattern that matches objects greater than or equal to a given object using the given ordering.
    static <A extends Comparable<? super A>>
    Pattern<A>
    lessThan(A other)
    Returns a pattern that matches objects less than a given object using natural ordering.
    static <A> Pattern<A>
    lessThan(Comparator<? super A> comparator, A other)
    Returns a pattern that matches objects less than a given object using the given ordering.
    static <A extends Comparable<? super A>>
    Pattern<A>
    lessThanOrEqual(A other)
    Returns a pattern that matches objects less than or equal to a given object using natural ordering.
    static <A> Pattern<A>
    lessThanOrEqual(Comparator<? super A> comparator, A other)
    Returns a pattern that matches objects less than or equal to a given object using the given ordering.
    static <A> Pattern<A>
    neq(A other)
    Returns a pattern that matches objects not identically equal to a given reference.
    static <A> Pattern<A>
    Returns a pattern that matches anything except the null reference.
    static <A> Pattern<A>
    nequal(A other)
    Returns a pattern that matches objects not equal to a given reference.
    static <A> Pattern<Optional<A>>
    present(Pattern<? super A> body)
    Return a pattern that matches an optional value if present.
    static final Pattern<Character>
    range(char from, char to)
    Returns a pattern that matches characters in a given range.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • isTrue

      public static final Pattern<Boolean> isTrue
      A pattern that matches the value true.
    • isFalse

      public static final Pattern<Boolean> isFalse
      A pattern that matches the value false.
    • positiveInteger

      public static final Pattern<Integer> positiveInteger
      A pattern that matches positive integer values.
    • zeroInteger

      public static final Pattern<Integer> zeroInteger
      A pattern that matches the integer value zero.
    • negativeInteger

      public static final Pattern<Integer> negativeInteger
      A pattern that matches negative integer values.
    • positiveDouble

      public static final Pattern<Double> positiveDouble
      A pattern that matches positive floating-point values.
    • zeroDouble

      public static final Pattern<Double> zeroDouble
      A pattern that matches the floating-point value zero.
    • negativeDouble

      public static final Pattern<Double> negativeDouble
      A pattern that matches negative floating-point values.
    • nanDouble

      public static final Pattern<Double> nanDouble
      A pattern that matches the floating-point value NaN.
    • finiteDouble

      public static final Pattern<Double> finiteDouble
      A pattern that matches finite floating-point values.
    • infiniteDouble

      public static final Pattern<Double> infiniteDouble
      A pattern that matches infinite floating-point values.
  • Method Details

    • equal

      public static <A> Pattern<A> equal(@Opt A other)
      Returns a pattern that matches objects equal to a given reference. Equality is determined as if by Objects.equals(java.lang.Object, java.lang.Object).

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with or null
      Returns:
      a pattern that matches objects equal to other
    • nequal

      public static <A> Pattern<A> nequal(@Opt A other)
      Returns a pattern that matches objects not equal to a given reference. Equality is determined as if by Objects.equals(java.lang.Object, java.lang.Object).

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with or null
      Returns:
      a pattern that matches objects not equal to other
    • eq

      public static <A> Pattern<A> eq(@Opt A other)
      Returns a pattern that matches objects identically equal to a given reference. Equality is determined by ==.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with or null
      Returns:
      a pattern that matches objects identically equal to other
    • neq

      public static <A> Pattern<A> neq(@Opt A other)
      Returns a pattern that matches objects not identically equal to a given reference. Equality is determined by !=.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with or null
      Returns:
      a pattern that matches objects identically equal to other
    • compareTo

      public static <A extends Comparable<? super A>> Pattern<A> compareTo(@Opt A other, Pattern<? super Integer> body)
      Returns a pattern that matches objects based on comparison with a given object using the natural ordering. Matching succeeds if and only if the result of comparing the target object via Comparable.compareTo(T) to a given object matches a given int pattern.

      A pattern returned by this method inherits determinism and variable bindings from the given pattern.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with or null
      body - a pattern to match the comparison result
      Returns:
      a pattern that matches objects with body based on comparison with other
      Throws:
      NullPointerException - if body is null
    • compare

      public static <A> Pattern<A> compare(Comparator<? super A> comparator, @Opt A other, Pattern<? super Integer> body)
      Returns a pattern that matches objects based on comparison with a given object using the given ordering. Matching succeeds if and only if the result of comparing the target object via Comparable.compareTo(T) to a given object matches a given int pattern.

      A pattern returned by this method inherits determinism and variable bindings from the given pattern.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      comparator - the comparator that specifies the ordering
      other - an object to compare with or null
      body - a pattern to match the comparison result
      Returns:
      a pattern that matches objects with body based on comparison with other
      Throws:
      NullPointerException - if comparator or body is null
    • lessThan

      public static <A extends Comparable<? super A>> Pattern<A> lessThan(A other)
      Returns a pattern that matches objects less than a given object using natural ordering. Ordering is determined by Comparable.compareTo(T).

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with
      Returns:
      a pattern that matches objects less than other
      Throws:
      NullPointerException - if other is null
    • lessThanOrEqual

      public static <A extends Comparable<? super A>> Pattern<A> lessThanOrEqual(A other)
      Returns a pattern that matches objects less than or equal to a given object using natural ordering. Ordering is determined by Comparable.compareTo(T).

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with
      Returns:
      a pattern that matches objects less than or equal to other
      Throws:
      NullPointerException - if other is null
    • greaterThan

      public static <A extends Comparable<? super A>> Pattern<A> greaterThan(A other)
      Returns a pattern that matches objects greater than a given object using natural ordering. Ordering is determined by Comparable.compareTo(T).

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with
      Returns:
      a pattern that matches objects greater than other
      Throws:
      NullPointerException - if other is null
    • greaterThanOrEqual

      public static <A extends Comparable<? super A>> Pattern<A> greaterThanOrEqual(A other)
      Returns a pattern that matches objects greater than or equal to a given object using natural ordering. Ordering is determined by Comparable.compareTo(T).

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      other - an object to compare with
      Returns:
      a pattern that matches objects greater than or equal to other
      Throws:
      NullPointerException - if other is null
    • lessThan

      public static <A> Pattern<A> lessThan(Comparator<? super A> comparator, @Opt A other)
      Returns a pattern that matches objects less than a given object using the given ordering. Comparisons involving null may or may not be supported, depending on the ordering implementation.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      comparator - the comparator that specifies the ordering
      other - an object to compare with
      Returns:
      a pattern that matches objects less than other according to comparator
      Throws:
      NullPointerException - if comparator is null
      See Also:
    • lessThanOrEqual

      public static <A> Pattern<A> lessThanOrEqual(Comparator<? super A> comparator, @Opt A other)
      Returns a pattern that matches objects less than or equal to a given object using the given ordering. Comparisons involving null may or may not be supported, depending on the ordering implementation.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      comparator - the comparator that specifies the ordering
      other - an object to compare with
      Returns:
      a pattern that matches objects less than or equal to other according to comparator
      Throws:
      NullPointerException - if comparator is null
      See Also:
    • greaterThan

      public static <A> Pattern<A> greaterThan(Comparator<? super A> comparator, @Opt A other)
      Returns a pattern that matches objects greater than a given object using the given ordering. Comparisons involving null may or may not be supported, depending on the ordering implementation.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      comparator - the comparator that specifies the ordering
      other - an object to compare with
      Returns:
      a pattern that matches objects greater than other according to comparator
      Throws:
      NullPointerException - if comparator is null
      See Also:
    • greaterThanOrEqual

      public static <A> Pattern<A> greaterThanOrEqual(Comparator<? super A> comparator, @Opt A other)
      Returns a pattern that matches objects greater than or equal to a given object using the given ordering. Comparisons involving null may or may not be supported, depending on the ordering implementation.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      comparator - the comparator that specifies the ordering
      other - an object to compare with
      Returns:
      a pattern that matches objects greater than or equal to other according to comparator
      Throws:
      NullPointerException - if comparator is null
      See Also:
    • eqNull

      public static <A> Pattern<A> eqNull()
      Returns a pattern that matches only the null reference.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Returns:
      a pattern that matches only null
    • neqNull

      public static <A> Pattern<A> neqNull()
      Returns a pattern that matches anything except the null reference.

      A pattern returned by this method is deterministic and binds no variables.

      Type Parameters:
      A - the target type of objects to match against
      Returns:
      a pattern that matches anything except null
    • range

      public static final Pattern<Character> range(char from, char to)
      Returns a pattern that matches characters in a given range.

      A pattern returned by this method is deterministic and binds no variables.

      Parameters:
      from - the lower bound of the range (inclusive)
      to - the upper bound of the range (inclusive)
      Returns:
      a pattern that matches characters greater or equal to from and less or equal to to
    • present

      public static <A> Pattern<Optional<A>> present(Pattern<? super A> body)
      Return a pattern that matches an optional value if present. Empty targets are not matched.
      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      body - the pattern to match a present value
      Returns:
      a pattern that matches a present optional value with body, or fails for empty targets
      Throws:
      NullPointerException - if body is null
      See Also:
    • emptyOr

      public static <A> Pattern<Optional<A>> emptyOr(Pattern<? super A> body)
      Return a pattern that matches an optional value if present. Empty targets are matched.
      Type Parameters:
      A - the target type of objects to match against
      Parameters:
      body - the pattern to match a present value
      Returns:
      a pattern that matches a present optional value with body, or succeeds silently for empty targets
      Throws:
      NullPointerException - if body is null
      See Also: