public class FA
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
java.util.Set<State> |
accept
Accept states (A).
|
Alphabet |
alphabet
The automaton alphabet (
![]() |
State |
initial
Initial state (q0).
|
java.util.Set<State> |
states
Set of
State objects (Q). |
java.util.Map<StateSymbolPair,State> |
transitions
Transition function (
![]() |
Constructor and Description |
---|
FA()
Constructs an uninitialized FA.
|
FA(Alphabet a)
Constructs a new FA consisting of one reject state.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(java.lang.String s)
Runs the given string on this automaton.
|
FA |
checkWellDefined()
Checks that this automaton is well-defined.
|
java.lang.Object |
clone()
Clones this automaton.
|
FA |
complement()
Constructs a new automaton that accepts the complement of the language of this automaton.
|
State |
delta(State q,
char c)
Looks up transition in transition function.
|
State |
deltaStar(State q,
java.lang.String s)
Performs transitions in extended transition function.
|
boolean |
equals(java.lang.Object obj)
Checks whether the language of this automaton is equal to the language of the given automaton.
|
java.util.Set<State> |
findReachableStates()
Finds the set of states that are reachable from the initial state.
|
java.lang.String |
getAShortestExample()
Returns a shortest string that is accepted by this automaton.
|
int |
getNumberOfStates()
Returns number of states in this automaton.
|
int |
hashCode()
Computes hash code for this object.
|
FA |
intersection(FA f)
Constructs a new automaton whose language is the intersection of the language of this automaton
and the language of the given automaton.
|
boolean |
isEmpty()
Checks whether the language of this automaton is empty.
|
boolean |
isFinite()
Checks whether the language of this automaton is finite.
|
FA |
minimize()
Constructs a new minimal automaton with the same language as this automaton.
|
FA |
minus(FA f)
Constructs a new automaton whose language is equal to the language of this automaton
minus the language of the given automaton.
|
FA |
removeUnreachableStates()
Constructs a new automaton with the same language as this automaton but without unreachable states.
|
void |
setTransition(State q,
char c,
State p)
Sets a transition in the transition function.
|
boolean |
subsetOf(FA f)
Checks whether the language of this automaton is a subset of the language of the given automaton.
|
java.lang.String |
toDot()
Returns Graphviz Dot
representation of this automaton.
|
NFA |
toNFA()
Converts this FA into an equivalent
NFA . |
RegExp |
toRegExp()
Converts this automaton into an equivalent
RegExp regular expression. |
FA |
union(FA f)
Constructs a new automaton whose language is the union of the language of this automaton
and the language of the given automaton.
|
public Alphabet alphabet
public java.util.Map<StateSymbolPair,State> transitions
public FA()
public FA(Alphabet a)
a
- automaton alphabetpublic boolean accepts(java.lang.String s) throws java.lang.IllegalArgumentException
s
- a stringjava.lang.IllegalArgumentException
- if a symbol in s is not in the alphabetpublic FA checkWellDefined() throws AutomatonNotWellDefinedException
AutomatonNotWellDefinedException
- if this automaton is not well-definedpublic java.lang.Object clone()
clone
in class java.lang.Object
public FA complement()
public State delta(State q, char c) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if c is not in the alphabetpublic State deltaStar(State q, java.lang.String s) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if a symbol in s is not in the alphabetpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.util.Set<State> findReachableStates()
public java.lang.String getAShortestExample()
public int getNumberOfStates()
public int hashCode()
equals(Object)
is implemented, hashCode must also be there.)hashCode
in class java.lang.Object
public FA intersection(FA f) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the alphabets of f and this automaton are not the samepublic boolean isEmpty()
public boolean isFinite()
public FA minimize()
public FA minus(FA f) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the alphabets of f and this automaton are not the samepublic FA removeUnreachableStates()
public void setTransition(State q, char c, State p)
public boolean subsetOf(FA f)
public java.lang.String toDot()
public NFA toNFA()
NFA
.
Note: this is trivial since an FA is just a special kind of NFA, except for the different representation.public RegExp toRegExp()
RegExp
regular expression. [Martin, Th. 3.30]public FA union(FA f) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if the alphabets of f and this automaton are not the sameNFA.union(regaut.NFA)
Copyright © 2003-2015 Anders Møller.