@Override
    public CountStateElement visitSequence_collection_stateful_source(
            @NotNull SiddhiQLParser.Sequence_collection_stateful_sourceContext ctx) {

//        sequence_collection_stateful_source
//        :standard_stateful_source ('<' collect '>'|zero_or_more='*'|zero_or_one='?'|one_or_more='+')
//        ;

        StreamStateElement streamStateElement = (StreamStateElement) visit(ctx.standard_stateful_source());

        if (ctx.one_or_more != null) {
            CountStateElement countStateElement = new CountStateElement(streamStateElement, 1,
                    CountStateElement.ANY);
            populateQueryContext(countStateElement, ctx);
            return countStateElement;
        } else if (ctx.zero_or_more != null) {
            CountStateElement countStateElement = new CountStateElement(streamStateElement, 0,
                    CountStateElement.ANY);
            populateQueryContext(countStateElement, ctx);
            return countStateElement;
        } else if (ctx.zero_or_one != null) {
            CountStateElement countStateElement = new CountStateElement(streamStateElement, 0, 1);
            populateQueryContext(countStateElement, ctx);
            return countStateElement;
        } else if (ctx.collect() != null) {
            Object[] minMax = (Object[]) visit(ctx.collect());
            int min = CountStateElement.ANY;
            int max = CountStateElement.ANY;
            if (minMax[0] != null) {
                min = (Integer) minMax[0];
            }
            if (minMax[1] != null) {
                max = (Integer) minMax[1];
            }
            CountStateElement countStateElement = new CountStateElement(streamStateElement, min, max);
            populateQueryContext(countStateElement, ctx);
            return countStateElement;
        } else {
            throw newSiddhiParserException(ctx);
        }
    }
{@inheritDoc}
<p>The default implementation returns the result of calling
{@link #visitChildren} on {@code ctx}.</p>

@param ctx
modules/siddhi-query-compiler/src/main/java/io/siddhi/query/compiler/internal/SiddhiQLBaseVisitorImpl.java