|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object finiteAutomata.Alphabet
public class Alphabet
A non-empty set of symbols. Alphabets are naturally associated with both finite automata (input symbols) and grammars (terminal symbols).
Field Summary | |
---|---|
protected java.lang.StringBuffer |
alpha
alphabet symbols |
Constructor Summary | |
---|---|
Alphabet(java.lang.String inString)
creates an Alphabet from the characters in a given string. |
Method Summary | |
---|---|
char |
charAt(int i)
Returns the i-th symbol in this Alphabet. |
boolean |
contains(char c)
Determines if a given character is a symbol in this Alphabet. |
java.util.Vector |
getLanguage(int n)
Generates the language of all strings over this Alphabet up to a given length. |
boolean |
indexArray(java.lang.String inString,
int[] array)
Converts each character in the given String to its position in this Alphabet. |
int |
indexOf(char c)
Determines the position of a given character in this Alphabet. |
static void |
main(java.lang.String[] args)
|
static void |
printLanguage(java.util.Vector v)
Prints a given Vector of objects (the "toString()" version of each object is printed). |
int |
size()
Returns number of symbols in this Alphabet. |
java.lang.String |
toPrettyString()
Converts this Alphabet to a String of symbols punctuated with braces and commas. |
java.lang.String |
toString()
Converts this Alphabet to a String of symbols. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.StringBuffer alpha
Constructor Detail |
---|
public Alphabet(java.lang.String inString)
inString
- String containing the desired alphabet characters
in the desired lexicographic orderMethod Detail |
---|
public int size()
public boolean contains(char c)
c
- char to be located
public int indexOf(char c)
c
- char to be located
public char charAt(int i)
i
- int position of interest
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toPrettyString()
public boolean indexArray(java.lang.String inString, int[] array)
inString
- the String of characters to be convertedarray
- of integers for returning the list
of positions
public static void printLanguage(java.util.Vector v)
v
- Vector of objects to be printedpublic java.util.Vector getLanguage(int n)
n
- maximum string length
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |