public class Automaton extends Object implements Acceptor, StateMachine, Rational, Cloneable
An automaton is a 5-uple A = (X , Q , I , T , D) where
In this implementation of automaton, any object may be a label, states are instance of class State and transitions are intances of class Transition. Only automata should create instances of states through Automaton method newState.
State| Constructor and Description |
|---|
Automaton()
Creates a new empty automaton which contains no state and no transition.
|
Automaton(StateFactory sf)
Create a new empty automaton with given state factory.
|
| Modifier and Type | Method and Description |
|---|---|
Set<State> |
accessibleAndCoAccessibleStates()
Returns the set of all states which are co-accessible and accessible in
this automaton.
|
Set<State> |
accessibleStates()
Returns the set of all accessible states in this automaton.
|
State |
addState(boolean initial,
boolean terminal)
Returns a new instance of state which will be initial and terminal or not
depending of parameters.
|
boolean |
addTransition(Transition transition)
Adds a new transition in this automaton if it is a new transition for
this automaton.
|
boolean |
addTransition(Transition transition,
String ifInvalid) |
Set<Object> |
alphabet()
Returns the alphabet -
S - of this state machine. |
Object |
clone()
returns a copy of this automaton.
|
Set<State> |
coAccessibleStates()
Returns the set of all co-accessible states in this automaton.
|
Set<Transition> |
delta()
Returns the set of all transitions of this automaton
|
Set<Transition> |
delta(Set<State> s)
Returns all transitions from a given set of states.
|
Set<Transition> |
delta(State state)
Return all transitions from a State.
|
Set<Transition> |
delta(State state,
Object label)
Returns the set of all transitions of this machine starting from a given
state and labelled with a given label.
|
Set<Transition> |
deltaFrom(State from,
State to) |
Set<Transition> |
deltaMinusOne(State st)
Returns the set of states that can access the given states' set
st. |
Set<Transition> |
deltaMinusOne(State state,
Object label)
Returns the set of all transitions of the reverse of this automaton
|
static Automaton |
epsilonAutomaton()
Returns an automaton which recognizes the regular language associated
with the regular expression @, where @ denotes the
empty word.
|
StateFactory |
getStateFactory()
Retrieves the state factory associated to this SM.
|
Set<State> |
initials()
Returns the set of initial states for this machine.
|
static Automaton |
labelAutomaton(Object label)
Returns an automaton which recognizes the regular language associated
with the regular expression l, where l is a given
label.
|
State |
state(Object label)
Create a new state with given label.
|
Set<State> |
states()
Returns the set of states Q associated with this automaton.
|
Set<State> |
step(Set<State> s,
Object o)
Return the set of states accessible in one transition from given set of
states s and letter o.
|
Set<State> |
steps(List<?> word) |
Set<State> |
steps(Set<State> s,
List<?> word)
Return the set of states this SM will be in after reading the word from
start states
s. |
Set<State> |
terminals()
Returns the set of terminal states T associated with this
automaton.
|
String |
toString()
returns a textual representation of this automaton.
|
boolean |
validTransition(Transition transition) |
public Automaton()
public Automaton(StateFactory sf)
sf - the StateFactory object to use for creating new states. May be
null.public StateFactory getStateFactory()
StateMachinegetStateFactory in interface StateMachinepublic static Automaton epsilonAutomaton()
public static Automaton labelAutomaton(Object label)
label - any object that will be used as a label.public State addState(boolean initial, boolean terminal)
RationaladdState in interface Rationalinitial - if true, the new state will be initial; otherwise this state
will be non initial.terminal - if true, the new state will be terminal; otherwise this state
will be non terminal.Transitionpublic Set<Object> alphabet()
StateMachineS - of this state machine.alphabet in interface Rationalalphabet in interface StateMachinepublic Set<State> states()
Rationalpublic Set<State> initials()
StateMachineinitials in interface Rationalinitials in interface StateMachineStatepublic Set<State> terminals()
Rationalpublic Set<State> accessibleStates()
RationalaccessibleStates in interface RationalStatepublic Set<State> coAccessibleStates()
RationalcoAccessibleStates in interface RationalStatepublic Set<State> accessibleAndCoAccessibleStates()
RationalaccessibleAndCoAccessibleStates in interface RationalStatepublic Set<Transition> delta()
Rationaldelta in interface RationalTransitionpublic Set<Transition> delta(State state, Object label)
StateMachinedelta in interface Rationaldelta in interface StateMachinestate - a state of this SM.label - a label used in this SM.Transitionpublic Set<Transition> deltaFrom(State from, State to)
public Set<Transition> delta(State state)
StateMachinedelta in interface Rationaldelta in interface StateMachinestate - start statepublic Set<Transition> delta(Set<State> s)
StateMachinedelta in interface StateMachines - a Set of State objectspublic Set<Transition> deltaMinusOne(State state, Object label)
deltaMinusOne in interface Rationalstate - statelabel - labelTransitionpublic boolean addTransition(Transition transition)
RationaladdTransition in interface Rationaltransition - the transition to add.public boolean validTransition(Transition transition)
validTransition in interface Rationaltransition - transition to checktransition is null or if
transition = (q , l , q') and q or
q' does not belong to Q the set of the states
of this automaton.public boolean addTransition(Transition transition, String ifInvalid)
addTransition in interface Rationaltransition - transition to addifInvalid - message to use in IllegalArgumentException if transition is
invalid; if null, no exception is thrownpublic String toString()
public Object clone()
public Set<State> steps(Set<State> s, List<?> word)
StateMachines.steps in interface StateMachines - the set of starting statesword - the word to read.null.public Set<State> step(Set<State> s, Object o)
StateMachinestep in interface StateMachines - the starting stateso - the letternull.public Set<Transition> deltaMinusOne(State st)
StateMachinest. This is the inverse relation of ddeltaMinusOne in interface RationaldeltaMinusOne in interface StateMachinest - end statesst. May be empty or
null.Copyright © 2020. All rights reserved.