finite automata example (#1364)
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
818eeeeb18
commit
19ff2eb487
29
algorithms/src/main/java/com/baeldung/automata/State.java
Normal file
29
algorithms/src/main/java/com/baeldung/automata/State.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.baeldung.automata;
|
||||
|
||||
/**
|
||||
* State. Part of a finite state machine.
|
||||
*/
|
||||
public interface State {
|
||||
|
||||
/**
|
||||
* Add a Transition to this state.
|
||||
* @param tr Given transition.
|
||||
* @return Modified State.
|
||||
*/
|
||||
State with(final Transition tr);
|
||||
|
||||
/**
|
||||
* Follow one of the transitions, to get
|
||||
* to the next state.
|
||||
* @param c Character.
|
||||
* @return State.
|
||||
* @throws IllegalStateException if the char is not accepted.
|
||||
*/
|
||||
State transit(final CharSequence c);
|
||||
|
||||
/**
|
||||
* Can the automaton stop on this state?
|
||||
* @return true or false
|
||||
*/
|
||||
boolean isFinal();
|
||||
}
|
||||
Reference in New Issue
Block a user