|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectdRegAut.NFALambda
Nondeterministic finite state automaton with
transitions.
| Field Summary | |
Set |
accept
Accept states (A). |
Alphabet |
alphabet
The automaton alphabet ( ). |
State |
initial
Initial state (q0). |
static Character |
LAMBDA
Our representation of . |
Set |
states
Set of State objects (Q). |
Map |
transitions
Transition function ( ).
|
| Constructor Summary | |
NFALambda()
Constructs an uninitialized NFALambda. |
|
| Method Summary | |
boolean |
accepts(String s)
Runs the given string on this automaton. |
void |
addLambda(State p,
State q)
Adds a transition. |
NFALambda |
checkWellDefined()
Checks that this automaton is well-defined. |
Object |
clone()
Clones this automaton. |
NFALambda |
concat(NFALambda f)
Constructs a new automaton whose language is the concatenation of the language of this automaton and the language of the given automaton. |
Set |
delta(State q,
Character c)
Looks up transitions in transition function. |
Set |
deltaStar(State q,
String s)
Performs transitions in extended transition function. |
int |
getNumberOfStates()
Returns number of states in this automaton. |
NFALambda |
kleene()
Constructs a new automaton whose language is the Kleene star of the language of this automaton. |
Set |
lambdaClosure(Set set)
Computes the -closure
of the given state set. |
static NFALambda |
makeEmptyLanguage(Alphabet a)
Constructs a new NFALambda that accepts the empty language. |
static NFALambda |
makeEmptyString(Alphabet a)
Constructs a new NFALambda that accepts the language containing only the empty string. |
static NFALambda |
makeSingleton(Alphabet a,
char c)
Constructs a new NFALambda that accepts the language containing only the given singleton string. |
NFA |
removeLambdas()
Constructs an equivalent NFA by reducing all
transitions
to other transitions. |
String |
toDot()
Returns Graphviz Dot representation of this automaton. |
NFALambda |
union(NFALambda f)
Constructs a new automaton whose language is the union of the language of this automaton and the language of the given automaton. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public Set accept
states.
public Alphabet alphabet
).
public State initial
states.
public static final Character LAMBDA
.
public Set states
State objects (Q).
public Map transitions
).
This is a map from pairs of states and alphabet symbols to sets of states
(
:
Q
(
{
})
2Q).
We represent
by LAMBDA.
| Constructor Detail |
public NFALambda()
| Method Detail |
public boolean accepts(String s)
throws IllegalArgumentException
s - a string
IllegalArgumentException - if a symbol in s is not in the alphabet
public void addLambda(State p,
State q)
transition.
p - from stateq - to state
public NFALambda checkWellDefined()
throws AutomatonNotWellDefinedException
AutomatonNotWellDefinedException - if this automaton is not well-definedpublic Object clone()
public NFALambda concat(NFALambda f)
throws IllegalArgumentException
IllegalArgumentException - if the alphabets of f and this automaton are not the same
public Set delta(State q,
Character c)
throws IllegalArgumentException
(q,c),
the result is never null and it should never be modified by the caller
IllegalArgumentException - if c is not in the alphabet
public Set deltaStar(State q,
String s)
throws IllegalArgumentException
*(q,s)
(the result is never null)
IllegalArgumentException - if a symbol in s is not in the alphabetpublic int getNumberOfStates()
public NFALambda kleene()
public Set lambdaClosure(Set set)
-closure
of the given state set. [Martin, Def. 4.6]
set - set of State objects
State objects (the input set is unmodified)public static NFALambda makeEmptyLanguage(Alphabet a)
a - automaton alphabetpublic static NFALambda makeEmptyString(Alphabet a)
a - automaton alphabet
public static NFALambda makeSingleton(Alphabet a,
char c)
a - automaton alphabetc - the symbol in the singleton stringpublic NFA removeLambdas()
NFA by reducing all
transitions
to other transitions. [Martin, Th. 4.2]
The input automaton is unmodified.
public String toDot()
public NFALambda union(NFALambda f)
throws IllegalArgumentException
IllegalArgumentException - if the alphabets of f and this automaton are not the same
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||