Class PrimitivePatterns

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

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 Details

    • MAX_COMPILED_STRING_CONST_LENGTH

      static final int MAX_COMPILED_STRING_CONST_LENGTH
      The maximum length of a string that may be embedded as a class file constant when compiling a pattern. Longer strings will be passed as environment objects.
      See Also:
    • compiledStringConstant

      static final Pattern<Object> compiledStringConstant
    • objectEquals

      static final Method objectEquals
    • integerValueOf

      static final Method integerValueOf
    • integerIntValue

      static final Method integerIntValue
    • doubleValueOf

      static final Method doubleValueOf
    • doubleDoubleValue

      static final Method doubleDoubleValue
    • doubleIsNaN

      static final Method doubleIsNaN
    • doubleIsFinite

      static final Method doubleIsFinite
    • doubleIsInfinite

      static final Method doubleIsInfinite
    • comparableCompareTo

      static final Method comparableCompareTo
    • comparatorCompare

      static final Method comparatorCompare
    • characterCharValue

      static final Method characterCharValue
    • p_null

      static final Pattern<Object> p_null
    • p_nonnull

      static final Pattern<Object> p_nonnull
    • 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.

      Parameters:
      other - an object to compare with or null.
    • 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.

      Parameters:
      other - an object to compare with or null.
    • eq

      public static <A> Pattern<A> eq(@Opt A a)
      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.

      Parameters:
      a - an object to compare with or null.
    • neq

      public static <A> Pattern<A> neq(@Opt A a)
      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.

      Parameters:
      a - an object to compare with or null.
    • 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. 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.

      Parameters:
      other - an object to compare with or null.
      body - a pattern to match the comparison result.
    • compare

      public static <A> Pattern<A> compare(Comparator<? super A> comparator, @Opt A other, Pattern<? super Integer> body)
    • lessThan

      public static <A extends Comparable<? super A>> Pattern<A> lessThan(A other)
    • lessThanOrEqual

      public static <A extends Comparable<? super A>> Pattern<A> lessThanOrEqual(A other)
    • greaterThan

      public static <A extends Comparable<? super A>> Pattern<A> greaterThan(A other)
    • greaterThanOrEqual

      public static <A extends Comparable<? super A>> Pattern<A> greaterThanOrEqual(A other)
    • lessThan

      public static <A> Pattern<A> lessThan(Comparator<? super A> comparator, @Opt A other)
    • lessThanOrEqual

      public static <A> Pattern<A> lessThanOrEqual(Comparator<? super A> comparator, @Opt A other)
    • greaterThan

      public static <A> Pattern<A> greaterThan(Comparator<? super A> comparator, @Opt A other)
    • greaterThanOrEqual

      public static <A> Pattern<A> greaterThanOrEqual(Comparator<? super A> comparator, @Opt A other)
    • 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.

    • neqNull

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

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

    • range

      public static final Pattern<Character> range(char from, char to)
      Returns a pattern that matches characters in a given range.
      Parameters:
      from - the lower bound of the range (inclusive).
      to - the upper bound of the range (inclusive).