public static void initStreamRuntime(StreamRuntime runtime, MetaComplexEvent metaComplexEvent,
                                         LockWrapper lockWrapper, String queryName) {

        if (runtime instanceof SingleStreamRuntime) {
            initSingleStreamRuntime((SingleStreamRuntime) runtime, 0, metaComplexEvent,
                    null, lockWrapper, queryName);
        } else {
            MetaStateEvent metaStateEvent = (MetaStateEvent) metaComplexEvent;
            StateEventFactory stateEventFactory = new StateEventFactory(metaStateEvent);
            MetaStreamEvent[] metaStreamEvents = metaStateEvent.getMetaStreamEvents();
            for (int i = 0, metaStreamEventsLength = metaStreamEvents.length; i < metaStreamEventsLength; i++) {
                initSingleStreamRuntime(runtime.getSingleStreamRuntimes().get(i), i, metaStateEvent, stateEventFactory,
                        lockWrapper, queryName);
            }
        }
    }
Helper method to clean/refactor MetaStreamEvent.

@param metaStreamEvent MetaStreamEvent
modules/siddhi-core/src/main/java/io/siddhi/core/util/parser/helper/QueryParserHelper.java