hcrypto.cipher
Class AlphabetFactory

java.lang.Object
  |
  +--hcrypto.cipher.AlphabetFactory

public class AlphabetFactory
extends java.lang.Object


Field Summary
static int ALPH_ascii
           
static int ALPH_az
           
static int ALPH_AZ
           
static int ALPH_azAZ
           
static int ALPH_azAZ09
           
static int ALPH_cryptogram
           
static int ALPH_hebrew
           
static int ALPH_printable
           
static int ALPH_unicode
           
static int MAX_ALPH_NUM
          The Alphabets are are numbered 0 through MAX_ALPH_NUM.
static int MAX_CHARS
           
 
Constructor Summary
AlphabetFactory()
           
 
Method Summary
static java.lang.String getDesc(int num)
          Returns a String description that specifies the range of the alphabet
static Alphabet getInstance(char[] ranges)
          Returns an Alphabet instance, constructed from an array subranges specified by their 16-bit Unicodes.
static Alphabet getInstance(java.lang.Character.UnicodeBlock[] blocks)
          Returns an Alphabet instance, constructed from an array of Unicode blocks
static Alphabet getInstance(int rangeId)
          Returns an Alphabet instance, constructed from a range identifier
static Alphabet getInstance(java.lang.String alphaDesc)
          This factory method returns an alphabet constructed from a string that describes the Unicode ranges that make up the alphabet.
static char getRangeHigh(java.lang.String alphDesc)
           
static int getRangeId(java.lang.String alphDesc)
          Returns the int ID for a given valid alphabet String descriptor and returns -1 for an invalid descriptor.
static char getRangeLow(java.lang.String alphDesc)
           
static char[] getRanges(java.lang.Character.UnicodeBlock[] blocks)
          Returns a character array of starting and ending char values for each of the Unicode ranges contained in its parameter.
static char[] getRanges(int id)
           
static char[] getRanges(java.lang.String alphaDesc)
          Returns a character array of starting and ending char values for each of the Unicode ranges included in this alphabet.
static boolean isValidAlphabetSpec(java.lang.String spec)
          Returns true iff its String parameter represents a valid alphabet ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_ALPH_NUM

public static final int MAX_ALPH_NUM
The Alphabets are are numbered 0 through MAX_ALPH_NUM. This constant is increased as additional alphabets are defined.

MAX_CHARS

public static final int MAX_CHARS

ALPH_az

public static final int ALPH_az

ALPH_AZ

public static final int ALPH_AZ

ALPH_azAZ

public static final int ALPH_azAZ

ALPH_azAZ09

public static final int ALPH_azAZ09

ALPH_printable

public static final int ALPH_printable

ALPH_ascii

public static final int ALPH_ascii

ALPH_cryptogram

public static final int ALPH_cryptogram

ALPH_unicode

public static final int ALPH_unicode

ALPH_hebrew

public static final int ALPH_hebrew
Constructor Detail

AlphabetFactory

public AlphabetFactory()
Method Detail

getInstance

public static Alphabet getInstance(char[] ranges)
                            throws java.lang.Exception
Returns an Alphabet instance, constructed from an array subranges specified by their 16-bit Unicodes.
Parameters:
ranges - -- an array of Unicode values specifying the disjoint subranges of the Alphabet.

getInstance

public static Alphabet getInstance(java.lang.Character.UnicodeBlock[] blocks)
                            throws java.lang.Exception
Returns an Alphabet instance, constructed from an array of Unicode blocks
Parameters:
blocks - -- an array of Unicode character blocks

getInstance

public static Alphabet getInstance(int rangeId)
                            throws java.lang.Exception
Returns an Alphabet instance, constructed from a range identifier
Parameters:
rangeId - -- an int specifying one of the disjoint subranges of the Alphabet.

getInstance

public static Alphabet getInstance(java.lang.String alphaDesc)
                            throws java.lang.Exception
This factory method returns an alphabet constructed from a string that describes the Unicode ranges that make up the alphabet.
Parameters:
alphaDesc - a String of the form "az+AZ+UnicodeBlock.GREEK" where each of the substrings separated by '+' are descriptors for contiguous ranges of the Unicode character sequence.

getRangeLow

public static char getRangeLow(java.lang.String alphDesc)
                        throws java.lang.Exception

getRangeHigh

public static char getRangeHigh(java.lang.String alphDesc)
                         throws java.lang.Exception

getRanges

public static char[] getRanges(java.lang.String alphaDesc)
Returns a character array of starting and ending char values for each of the Unicode ranges included in this alphabet.
Parameters:
alphaDesc - a String of the form "az+AZ+Range.04+UnicodeBlock.GREEK" where "GREEK" must be a valid name of one of the Character.UnicodeBlock ranges.

getRanges

public static char[] getRanges(java.lang.Character.UnicodeBlock[] blocks)
Returns a character array of starting and ending char values for each of the Unicode ranges contained in its parameter.
Parameters:
blocks - an array of UnicodeBlocks, such as [Character.UnicodeBlock.GREEK, Character.UnicodeBlock.KATAKANA]

getRanges

public static char[] getRanges(int id)

getDesc

public static java.lang.String getDesc(int num)
Returns a String description that specifies the range of the alphabet
Parameters:
num - is an int specifying the alphabet ID which should be between 0 and MAX_ALPH_NUM.

getRangeId

public static int getRangeId(java.lang.String alphDesc)
                      throws java.lang.Exception
Returns the int ID for a given valid alphabet String descriptor and returns -1 for an invalid descriptor.
Parameters:
alphDesc - a String specifying the descriptor, which should be one of: az, AZ, azAZ, azAZ09, printable, ascii

isValidAlphabetSpec

public static boolean isValidAlphabetSpec(java.lang.String spec)
Returns true iff its String parameter represents a valid alphabet ID.
Parameters:
spec - a String specifying the descriptor, which should be one of: az, AZ, azAZ, azAZ09, printable, ascii