jfun.parsec.pattern
Class CharPredicates

java.lang.Object
  extended by jfun.parsec.pattern.CharPredicates

public final class CharPredicates
extends java.lang.Object

This class provides some common CharPredicate implementations.

Author:
Ben Yu Dec 11, 2004

Constructor Summary
CharPredicates()
           
 
Method Summary
static CharPredicate always()
          A predicate that always returns true.
static CharPredicate among(char[] chars)
          among chars.
static CharPredicate and(CharPredicate... cps)
          Logical and of an array of CharPredicate objects.
static CharPredicate and(CharPredicate cp1, CharPredicate cp2)
          Logical and of two CharPredicate objects.
static CharPredicate isAlpha_()
          [a-zA-Z_].
static CharPredicate isAlpha()
          [a-zA-Z].
static CharPredicate isAlphaNumeric()
          [a-zA-Z0-9_]
static CharPredicate isChar(char a)
          == a.
static CharPredicate isDigit()
          between 0 and 9.
static CharPredicate isHexDigit()
          is hex digit.
static CharPredicate isLetter()
          is letter.
static CharPredicate isLowercase()
          [a-z].
static CharPredicate isUppercase()
          [A-Z].
static CharPredicate isWhitespace()
          is white space.
static CharPredicate never()
          A predicate that always returns false.
static CharPredicate not(CharPredicate cp)
          Negate a CharPredicate object.
static CharPredicate notAmong(char[] chars)
          not among chars.
static CharPredicate notChar(char a)
          != a.
static CharPredicate notRange(char a, char b)
          not between a and b inclusive.
static CharPredicate or(CharPredicate... cps)
          Logical or of an array of CharPredicate objects.
static CharPredicate or(CharPredicate cp1, CharPredicate cp2)
          Logical or of two CharPredicate objects.
static CharPredicate range(char a, char b)
          between a and b inclusive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharPredicates

public CharPredicates()
Method Detail

isChar

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


notChar

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


range

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


isDigit

public static CharPredicate isDigit()
between 0 and 9.


notRange

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


among

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


notAmong

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


isHexDigit

public static CharPredicate isHexDigit()
is hex digit.


isUppercase

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


isLowercase

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


isWhitespace

public static CharPredicate isWhitespace()
is white space.


isAlpha

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


isAlpha_

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


isLetter

public static CharPredicate isLetter()
is letter.


isAlphaNumeric

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


not

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


and

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


or

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


and

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


or

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


never

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


always

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