|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.ObjectdRegAut.NFALambda
public class NFALambda
Nondeterministic finite state automaton with
transitions.
| Field Summary | |
|---|---|
Set<State> |
accept
Accept states (A). |
Alphabet |
alphabet
The automaton alphabet ( ). |
State |
initial
Initial state (q0). |
static char |
LAMBDA
Our representation of . |
Set<State> |
states
Set of State objects (Q). |
Map<StateSymbolPair,Set<State>> |
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<State> |
delta(State q,
char c)
Looks up transitions in transition function. |
Set<State> |
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<State> |
lambdaClosure(Set<State> 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<State> accept
states.
public Alphabet alphabet
).
public State initial
states.
public static final char LAMBDA
.
public Set<State> states
State objects (Q).
public Map<StateSymbolPair,Set<State>> 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()
clone in class Object
public NFALambda concat(NFALambda f)
throws IllegalArgumentException
IllegalArgumentException - if the alphabets of f and this automaton are not the same
public Set<State> delta(State q,
char 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<State> 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<State> lambdaClosure(Set<State> 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 | |||||