I want to generate a tree-based menu using Java that will appear on a USSD browser. Each node may have children, ending with leaf nodes. I will also have to maintain state regarding each user who accesses this menu (like his current position on the menu) to facilitate navigation.
Any ideas on how I may achieve the tree generation and state management?
I assume that you get a message from the gateway such as: (Session#, UserInput) and you need to compute the next information to send to the user ?
I propose:
table CURRENTSTATE:
Session#
State
table STATES:
State
Title
table CHOICES:
State
Choice
Name
DoCode
NewState
Then when you get the message (Session#, UserInput):
Is that a reasonable way to solve the problem ?