public class Alphabet extends java.lang.Object
Aditional documentation: see Section 5.1, p.698, of "Algorithms, 4th Edition", by Robert Sedgewick e Kevin Wayne.
Modifier and Type | Field and Description |
---|---|
static Alphabet |
ASCII
This is the 128-character ASCII alphabet.
|
static Alphabet |
BASE64
This is the 64-letter alphabet {A,B,..,Z,a,b,..,z,0,1,..,9,+,/}.
|
static Alphabet |
BINARY
This is the alphabet {0,1}.
|
static Alphabet |
DECIMAL
This is the alphabet {0,1,..,9}.
|
static Alphabet |
DNA
This is the alphabet {A,C,T,G}.
|
static Alphabet |
EXTENDED_ASCII
This is the 256-character extended ASCII alphabet.
|
static Alphabet |
HEXADECIMAL
This is the alphabet {0,1,..,9,A,..,F}.
|
static Alphabet |
LOWERCASE
This is the 26-letter alphabet {a,b,..,x,y,z}.
|
static Alphabet |
OCTAL
This is the alphabet {0,1,..,7}.
|
static Alphabet |
PROTEIN
This is the 20-letter alphabet {A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y}.
|
static Alphabet |
UNICODE16
This is the 65536-character UNICODE alphabet.
|
static Alphabet |
UPPERCASE
This is the 26-letter alphabet {A,B,..,X,Y,Z}.
|
Constructor and Description |
---|
Alphabet()
Constructor 2 (extended ASCII).
|
Alphabet(java.lang.String alpha)
Constructor 1.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(char c)
Is character c in the alphabet?.
|
int |
lgR()
Returns number of bits necessary to represent
the index of a character.
|
static void |
main(java.lang.String[] args)
Test client (ignores command-line arguments).
|
int |
R()
Returns radix R.
|
char |
toChar(int index)
Converts an index between 0 and R-1 into a char over this alphabet.
|
java.lang.String |
toChars(int[] indices)
Converts array indices[] that represents a base-R integer
into a String over this alphabet.
|
int |
toIndex(char c)
Converts character c to a number in 0..R-1.
|
int[] |
toIndices(java.lang.String s)
Receives a string s over this alphabet and
converts s into a base-R int array.
|
public static final Alphabet BINARY
public static final Alphabet OCTAL
public static final Alphabet DECIMAL
public static final Alphabet HEXADECIMAL
public static final Alphabet DNA
public static final Alphabet LOWERCASE
public static final Alphabet UPPERCASE
public static final Alphabet PROTEIN
public static final Alphabet BASE64
public static final Alphabet ASCII
public static final Alphabet EXTENDED_ASCII
public static final Alphabet UNICODE16
public Alphabet(java.lang.String alpha)
public Alphabet()
public boolean contains(char c)
public int R()
public int lgR()
public int toIndex(char c)
public int[] toIndices(java.lang.String s)
public char toChar(int index)
public java.lang.String toChars(int[] indices)
public static void main(java.lang.String[] args)