jfun.parsec.pattern

Class CharPredicates

public final class CharPredicates extends Object

This class provides some common CharPredicate implementations.

Author: Ben Yu Dec 11, 2004

Method Summary
static CharPredicatealways()
A predicate that always returns true.
static CharPredicateamong(char[] chars)
among chars.
static CharPredicateand(CharPredicate cp1, CharPredicate cp2)
Logical and of two CharPredicate objects.
static CharPredicateand(CharPredicate... cps)
Logical and of an array of CharPredicate objects.
static CharPredicateisAlpha()
[a-zA-Z].
static CharPredicateisAlphaNumeric()
[a-zA-Z0-9_]
static CharPredicateisAlpha_()
[a-zA-Z_].
static CharPredicateisChar(char a)
== a.
static CharPredicateisDigit()
between 0 and 9.
static CharPredicateisHexDigit()
is hex digit.
static CharPredicateisLetter()
is letter.
static CharPredicateisLowercase()
[a-z].
static CharPredicateisUppercase()
[A-Z].
static CharPredicateisWhitespace()
is white space.
static CharPredicatenever()
A predicate that always returns false.
static CharPredicatenot(CharPredicate cp)
Negate a CharPredicate object.
static CharPredicatenotAmong(char[] chars)
not among chars.
static CharPredicatenotChar(char a)
!
static CharPredicatenotRange(char a, char b)
not between a and b inclusive.
static CharPredicateor(CharPredicate cp1, CharPredicate cp2)
Logical or of two CharPredicate objects.
static CharPredicateor(CharPredicate... cps)
Logical or of an array of CharPredicate objects.
static CharPredicaterange(char a, char b)
between a and b inclusive.

Method Detail

always

public static CharPredicate always()
A predicate that always returns true.

among

public static CharPredicate among(char[] chars)
among chars.

and

public static CharPredicate and(CharPredicate cp1, CharPredicate cp2)
Logical and of two CharPredicate objects.

and

public static CharPredicate and(CharPredicate... cps)
Logical and of an array of CharPredicate objects.

isAlpha

public static CharPredicate isAlpha()
[a-zA-Z].

isAlphaNumeric

public static CharPredicate isAlphaNumeric()
[a-zA-Z0-9_]

isAlpha_

public static CharPredicate isAlpha_()
[a-zA-Z_].

isChar

public static CharPredicate isChar(char a)
== a.

isDigit

public static CharPredicate isDigit()
between 0 and 9.

isHexDigit

public static CharPredicate isHexDigit()
is hex digit.

isLetter

public static CharPredicate isLetter()
is letter.

isLowercase

public static CharPredicate isLowercase()
[a-z].

isUppercase

public static CharPredicate isUppercase()
[A-Z].

isWhitespace

public static CharPredicate isWhitespace()
is white space.

never

public static CharPredicate never()
A predicate that always returns false.

not

public static CharPredicate not(CharPredicate cp)
Negate a CharPredicate object.

notAmong

public static CharPredicate notAmong(char[] chars)
not among chars.

notChar

public static CharPredicate notChar(char a)
!= a.

notRange

public static CharPredicate notRange(char a, char b)
not between a and b inclusive.

or

public static CharPredicate or(CharPredicate cp1, CharPredicate cp2)
Logical or of two CharPredicate objects.

or

public static CharPredicate or(CharPredicate... cps)
Logical or of an array of CharPredicate objects.

range

public static CharPredicate range(char a, char b)
between a and b inclusive.