By moving the parsing code into Engine, the condition and action handlers get the pre-parsed sentence. The parsing is done in ConversationParser, so the quest classes can be freed from all word processing code.
Required changes involve:
- call ConversationParser in Engine
- replace the 'String text' parameter in PreTransitionCondition and PostTransitionAction by 'Sentence sentence'
- adjust all derived classes to be compatible with the new interfaces
- replace old text parsing code by using ConversationParser/Sentence
I successfully tried the code changes in my local working copy and ensured of unchanged functionality by running the JUnit tests.
The big advantage of this is, there is only one place where text parsing is done. This ensures a uniform user interface and consistent in-code handling. The parser class can be extended to handle even more complex input syntax in future without having to code it at various scattered places.