org.apache.derbyTesting.functionTests.util.streams
Class CharAlphabet

java.lang.Object
  extended by org.apache.derbyTesting.functionTests.util.streams.CharAlphabet

public class CharAlphabet
extends java.lang.Object

A looping alphabet, returning characters. The alphabet loops over a list of characters. The alphabet-object is used by looping readers, which in turn is used for testing methods requiring streaming inputs. The following alphabets have been defined:


Field Summary
private  int charCount
          Number of characters in the alphabet.
private  char[] chars
          Characters in the alphabet.
static char[] CJKSUBSET
          CJK subset; 12 letters, UNICODE U4E00
static char[] MODERNLATINLOWER
          Modern latin, lowercase; a - z, 26 letters
private  java.lang.String name
          Name of the alphabet.
static char[] NO_DK_LOWER
          Norwegian/Danish alphabet, lowercase; 29 letters
private  int off
          Current offset into the alphabet/character array.
static char[] TAMIL
          Subset of Tamil alphabet; 46 letters, UNICODE U0B80
 
Constructor Summary
private CharAlphabet(java.lang.String name, char[] chars)
          Create an alphabet with the given name and characters.
 
Method Summary
 int charCount()
          Return the number of characters in the alphabet.
static CharAlphabet cjkSubset()
          Get a CJK subset alphabet.
 java.lang.String getName()
          Return the name of the alphabet.
static CharAlphabet modernLatinLowercase()
          Get a modern latin lowercase alphabet.
 char nextChar()
          Return the next char.
 int nextCharAsInt()
          Return the next char as an integer.
 int nextCharToRead(int charsRead)
          Compute the next character to read after reading the specified number of characters.
 void reset()
          Reset the alphabet, the next character returned will be the first character in the alphabet.
static CharAlphabet tamil()
          Get a Tamil alphabet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODERNLATINLOWER

public static char[] MODERNLATINLOWER
Modern latin, lowercase; a - z, 26 letters


NO_DK_LOWER

public static char[] NO_DK_LOWER
Norwegian/Danish alphabet, lowercase; 29 letters


TAMIL

public static char[] TAMIL
Subset of Tamil alphabet; 46 letters, UNICODE U0B80


CJKSUBSET

public static char[] CJKSUBSET
CJK subset; 12 letters, UNICODE U4E00


name

private final java.lang.String name
Name of the alphabet.


chars

private final char[] chars
Characters in the alphabet.


charCount

private final int charCount
Number of characters in the alphabet.


off

private int off
Current offset into the alphabet/character array.

Constructor Detail

CharAlphabet

private CharAlphabet(java.lang.String name,
                     char[] chars)
Create an alphabet with the given name and characters.

Parameters:
name - name of the alphabet
chars - characters in the alphabet.
Method Detail

modernLatinLowercase

public static CharAlphabet modernLatinLowercase()
Get a modern latin lowercase alphabet.


cjkSubset

public static CharAlphabet cjkSubset()
Get a CJK subset alphabet.


tamil

public static CharAlphabet tamil()
Get a Tamil alphabet


getName

public java.lang.String getName()
Return the name of the alphabet.


charCount

public int charCount()
Return the number of characters in the alphabet.


nextCharAsInt

public int nextCharAsInt()
Return the next char as an integer.

Returns:
the next character in the alphabet as an integer

nextChar

public char nextChar()
Return the next char.

Returns:
the next character in the alphabet

nextCharToRead

public int nextCharToRead(int charsRead)
Compute the next character to read after reading the specified number of characters. Besides from returning the index, the internal state of the alphabet is updated.

Parameters:
charsRead - the number of characters read
Returns:
the index of the next character

reset

public void reset()
Reset the alphabet, the next character returned will be the first character in the alphabet.


Built on Thu 2008-08-14 18:45:39-0700, from revision 686102

Apache Derby V10.5 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.