Interface IExecutingLikeMultiSwitchNode<TData>

    • Method Detail

      • findNextSwitchCaseIndex

        default int findNextSwitchCaseIndex​(int switchCaseIndex,
                                            int currentIndex,
                                            int childCount)
        It may be possible that multiple switch cases are matching. If that is the case, the switch may decide to execute all such switch cases in some defined order. This method allows finding all switch cases which might be executed after a given case.

        The default implementation assumes that multiple matching switch cases are executed in the order of how they appear in the list of children of the switch node, from the left to the right.

        Parameters:
        switchCaseIndex - Index of a switch case for which to find all switch cases that might be executed after it.
        currentIndex - Current index, either the switchCaseIndex when starting the iteration, or the last value returned by this method.
        childCount - Total number of children of the switch node.
        Returns:
        The index of the next switch case, or -1 if no more switch cases exist that may be executed afterwards. When this method returns a value >= the number of children, it is treated as if -1 had been returned. If this method returns the default case index, that index is skipped.
      • getDefaultCaseChildIndex

        int getDefaultCaseChildIndex()
        Returns:
        Index of the child representing the default case. If negative, the number of children is added to the index, so that -1 is the last child, -2 the seconds to last child etc.