Help needed to create an Automata state machine in Java
im trying to create a finite automata state machine, whereby a state can have several transitions to other states.
Ive tried an implementation where each state was an object from a State class, however, each state had to be constructed using a constructor. This is tedious for a large automata. So i had to scrap that idea.
I used a HashMap structure, but i dont think i understand it fully...
what im trying to create is something as follows:
based on user input, n amount of states should be created , where n is any integer. (This was not possible when each state was an object).
each state can have several transitions to other states:
ive thought of doing Map<State, List<Transition>> states = new Hashmap <State,List<Transition>();
this way, each state can have an list of transitions...
Transition has (symbol, state) as it parameters...
the above is what im trying to create, but i would appreciate if someone could advise as to how to create transitions by adding (symbol, state) within the list for each individual state