com.lonniepryor.blues.util
Class Characters

java.lang.Object
  |
  +--com.lonniepryor.blues.util.Characters

public abstract class Characters
extends java.lang.Object

Specification interface for identifying Characters. Instances of this class may be logically combined using the AND, OR, and NOT operations. Instances may also be sequentially constructed using the Builder class. Many common use-cases are supplied via static accessor methods.

Version:
$Revision: 1.1 $
Author:
Lonnie Pryor

Constructor Summary
protected Characters()
          Creates a new Characters object.
 
Method Summary
 Characters and(Characters specification)
          Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right.
static Characters digits()
          Returns a specification satisfied by digit characters.
static Characters equalTo(char c)
          Returns a specification satisfied by the specified character.
protected abstract  boolean isSatisfiedBy(char canidate)
          Returns true if the specified char satisfies this specification.
 boolean isSatisfiedByAll(char[] all)
          Returns true if all of the supplied Characters satisfy this specification.
 boolean isSatisfiedByAny(char[] any)
          Returns true if any of the supplied Characters satisfy this specification.
static Characters letters()
          Returns a specification satisfied by letter characters.
static Characters lowerCase()
          Returns a specification satisfied by upper case characters.
 Characters not()
          Returns a specification representing a logical NOT of this specification.
 Characters or(Characters specification)
          Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right.
 char[] selectAll(char[] from)
          Selects all the Characters that satisfy this specification from the supplied array.
 char selectFirst(char[] from)
          Selects the first Characters that satisfies this specification from the supplied array.
static Characters upperCase()
          Returns a specification satisfied by upper case characters.
static Characters whitespace()
          Returns a specification satisfied by whitespace characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Characters

protected Characters()
Creates a new Characters object.

Method Detail

digits

public static Characters digits()
Returns a specification satisfied by digit characters.

Returns:
A specification satisfied by digit characters.

letters

public static Characters letters()
Returns a specification satisfied by letter characters.

Returns:
A specification satisfied by letter characters.

lowerCase

public static Characters lowerCase()
Returns a specification satisfied by upper case characters.

Returns:
A specification satisfied by upper case characters.

upperCase

public static Characters upperCase()
Returns a specification satisfied by upper case characters.

Returns:
A specification satisfied by upper case characters.

whitespace

public static Characters whitespace()
Returns a specification satisfied by whitespace characters.

Returns:
A specification satisfied by whitespace characters.

equalTo

public static Characters equalTo(char c)
Returns a specification satisfied by the specified character.

Parameters:
c - The character to match to.
Returns:
A specification satisfied by the specified character.

isSatisfiedBy

protected abstract boolean isSatisfiedBy(char canidate)
Returns true if the specified char satisfies this specification.

Parameters:
canidate - The character to test.
Returns:
True if the specified char satisfies this specification.

isSatisfiedByAll

public final boolean isSatisfiedByAll(char[] all)
Returns true if all of the supplied Characters satisfy this specification.

Parameters:
all - The array of Characters to test.
Returns:
True if all of the supplied Characters satisfy this specification.

isSatisfiedByAny

public final boolean isSatisfiedByAny(char[] any)
Returns true if any of the supplied Characters satisfy this specification.

Parameters:
any - The array of Characters to test.
Returns:
True if any of the supplied Characters satisfy this specification.

selectFirst

public final char selectFirst(char[] from)
Selects the first Characters that satisfies this specification from the supplied array.

Parameters:
from - The array to select from.
Returns:
The first Characters that satisfies this specification from the supplied array.

selectAll

public final char[] selectAll(char[] from)
Selects all the Characters that satisfy this specification from the supplied array.

Parameters:
from - The array to select from.
Returns:
All the Characters that satisfy this specification from the supplied array.

and

public final Characters and(Characters specification)
Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right.

Parameters:
specification - The specification to AND with.
Returns:
A specification representing a logical AND of this specification on the left and the supplied specification on the right.

or

public final Characters or(Characters specification)
Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right.

Parameters:
specification - The specification to OR with.
Returns:
A specification representing a logical OR of this specification on the left and the supplied specification on the right.

not

public final Characters not()
Returns a specification representing a logical NOT of this specification.

Returns:
A specification representing a logical NOT of this specification.


Copyright © 2003 Blues Framework. All Rights Reserved.