finite automata example (#1364)

This commit is contained in:
Mihai Emil Andronache
2017-03-12 18:15:29 +02:00
committed by Grzegorz Piwowarek
parent 818eeeeb18
commit 19ff2eb487
7 changed files with 254 additions and 0 deletions

View 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();
}