implement substitute(charx, chary)
Closed this issue · 1 comments
bradengroom commented
This method should go through each transition and change its character to chary if it matches charx.
bradengroom commented
def substitute(oldChar: Char, newChar: Char): Automaton = {
this.states.foreach(state => {
state.getTransitions.filter(_.char == oldChar).foreach(transition => {
state.addTransition(new Transition(transition.end, newChar))
state.removeTransition(transition)
})
})
this
}