Package eu.bandm.tools.paisley
Class PrimitivePatterns
java.lang.Object
eu.bandm.tools.paisley.PrimitivePatterns
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
Modifier and TypeFieldDescription(package private) static final Method
(package private) static final Method
(package private) static final Method
(package private) static final Method
(package private) static final Method
(package private) static final Method
(package private) static final Method
(package private) static final Method
A pattern that matches finite floating-point values.A pattern that matches infinite floating-point values.(package private) static final Method
(package private) static final Method
A pattern that matches the valuefalse
.A pattern that matches the valuetrue
.(package private) static final int
The maximum length of a string that may be embedded as a class file constant when compiling a pattern.A pattern that matches the floating-point valueNaN
.A pattern that matches negative floating-point values.A pattern that matches negative integer values.(package private) static final Method
A pattern that matches positive floating-point values.A pattern that matches positive integer values.A pattern that matches the floating-point value zero.A pattern that matches the integer value zero. -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> Pattern<A>
compare
(Comparator<? super A> comparator, A other, Pattern<? super Integer> body) static <A extends Comparable<? super A>>
Pattern<A>Returns a pattern that matches objects based on comparison with a given object.static <A> Pattern<A>
eq
(A a) Returns a pattern that matches objects identically equal to a given reference.static <A> Pattern<A>
eqNull()
Returns a pattern that matches only thenull
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) static <A> Pattern<A>
greaterThan
(Comparator<? super A> comparator, A other) static <A extends Comparable<? super A>>
Pattern<A>greaterThanOrEqual
(A other) static <A> Pattern<A>
greaterThanOrEqual
(Comparator<? super A> comparator, A other) static <A extends Comparable<? super A>>
Pattern<A>lessThan
(A other) static <A> Pattern<A>
lessThan
(Comparator<? super A> comparator, A other) static <A extends Comparable<? super A>>
Pattern<A>lessThanOrEqual
(A other) static <A> Pattern<A>
lessThanOrEqual
(Comparator<? super A> comparator, A other) static <A> Pattern<A>
neq
(A a) Returns a pattern that matches objects not identically equal to a given reference.static <A> Pattern<A>
neqNull()
Returns a pattern that matches anything but thenull
reference.static <A> Pattern<A>
nequal
(A other) Returns a pattern that matches objects not equal to a given reference.Return a pattern that matches an optional value if present.range
(char from, char to) Returns a pattern that matches characters in a given range.
-
Field Details
-
MAX_COMPILED_STRING_CONST_LENGTH
static final int MAX_COMPILED_STRING_CONST_LENGTHThe 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
-
objectEquals
-
integerValueOf
-
integerIntValue
-
doubleValueOf
-
doubleDoubleValue
-
doubleIsNaN
-
doubleIsFinite
-
doubleIsInfinite
-
comparableCompareTo
-
comparatorCompare
-
characterCharValue
-
p_null
-
p_nonnull
-
isTrue
A pattern that matches the valuetrue
. -
isFalse
A pattern that matches the valuefalse
. -
positiveInteger
A pattern that matches positive integer values. -
zeroInteger
A pattern that matches the integer value zero. -
negativeInteger
A pattern that matches negative integer values. -
positiveDouble
A pattern that matches positive floating-point values. -
zeroDouble
A pattern that matches the floating-point value zero. -
negativeDouble
A pattern that matches negative floating-point values. -
nanDouble
A pattern that matches the floating-point valueNaN
. -
finiteDouble
A pattern that matches finite floating-point values. -
infiniteDouble
A pattern that matches infinite floating-point values.
-
-
Method Details
-
equal
Returns a pattern that matches objects equal to a given reference. Equality is determined as if byObjects.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 ornull
.
-
nequal
Returns a pattern that matches objects not equal to a given reference. Equality is determined as if byObjects.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 ornull
.
-
eq
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 ornull
.
-
neq
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 ornull
.
-
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 viaComparable.compareTo(T)
to a given object matches a givenint
pattern.A pattern returned by this method inherits determinism and variable bindings from the given pattern.
- Parameters:
other
- an object to compare with ornull
.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
-
lessThanOrEqual
-
greaterThan
-
greaterThanOrEqual
-
lessThan
-
lessThanOrEqual
-
greaterThan
-
greaterThanOrEqual
-
eqNull
Returns a pattern that matches only thenull
reference.A pattern returned by this method is deterministic and binds no variables.
-
neqNull
Returns a pattern that matches anything but thenull
reference.A pattern returned by this method is deterministic and binds no variables.
-
range
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).
-
present
Return a pattern that matches an optional value if present. Empty arguments are not matched.- Parameters:
body
- the pattern to match a present value
-