Patent ID: 7451299

Claim:
A computer-based system to provide multi-way branching in a state machine, comprising: at least one processor and memory, the at least one processor and memory implementing: one or more states maintained in the state machine, wherein the one or more states includes a first state; a plurality of input events sent to the state machine; a plurality of output events generated from the state machine in response to the plurality of input events; and a multi-way branch associated with the first state in the one or more states; wherein the multi-way branch is implemented in bytecodes in Java and is operable to determine a next state in the one or more states to jump to from the first state based on the value of a switch expression in the multi-way branch; wherein the multi-way branch is implemented using an array, wherein the indices of the array represent the values of the switch expression in the multi-way branch, and the values of the array represent the locations of the next state to jump to; and wherein the multi-way branch is implemented via the following steps: constructing one or more subarrays to form a disjoint covering for the array; determining an optimal branch implementation for each subarray in the one or more subarrays; and determining an optimal implementation for each union of two or more of the one or more subarrays using a dynamic programming algorithm.