Esempio n. 1
0
        private static GraphOperatorSpec ParseOp(
            EsperEPL2GrammarParser.GopContext ctx,
            IDictionary<ITree, object> astGraphNodeMap,
            ImportServiceCompileTime importService)
        {
            var operatorName = ctx.opName != null ? ctx.opName.Text : ctx.s.Text;

            var input = new GraphOperatorInput();
            if (ctx.gopParams() != null)
            {
                ParseParams(ctx.gopParams(), input);
            }

            var output = new GraphOperatorOutput();
            if (ctx.gopOut() != null)
            {
                ParseOutput(ctx.gopOut(), output);
            }

            GraphOperatorDetail detail = null;
            if (ctx.gopDetail() != null)
            {
                IDictionary<string, object> configs = new LinkedHashMap<string, object>();
                IList<EsperEPL2GrammarParser.GopConfigContext> cfgctxs = ctx.gopDetail().gopConfig();
                foreach (var cfgctx in cfgctxs)
                {
                    string name;
                    object value = astGraphNodeMap.Delete(cfgctx);
                    if (cfgctx.n != null)
                    {
                        name = cfgctx.n.Text;
                    }
                    else
                    {
                        name = "select";
                    }

                    configs.Put(name, value);
                }

                detail = new GraphOperatorDetail(configs);
            }

            IList<AnnotationDesc> annotations;
            if (ctx.annotationEnum() != null)
            {
                IList<EsperEPL2GrammarParser.AnnotationEnumContext> annoctxs = ctx.annotationEnum();
                annotations = new List<AnnotationDesc>();
                foreach (EsperEPL2GrammarParser.AnnotationEnumContext annoctx in annoctxs)
                {
                    annotations.Add(ASTAnnotationHelper.Walk(annoctx, importService));
                }
            }
            else
            {
                annotations = new EmptyList<AnnotationDesc>();
            }

            return new GraphOperatorSpec(operatorName, input, output, detail, annotations);
        }
Esempio n. 2
0
        private static GraphOperatorSpec ParseOp(EsperEPL2GrammarParser.GopContext ctx, IDictionary <ITree, Object> astGraphNodeMap, EngineImportService engineImportService)
        {
            var operatorName = ctx.opName != null ? ctx.opName.Text : ctx.s.Text;

            var input = new GraphOperatorInput();

            if (ctx.gopParams() != null)
            {
                ParseParams(ctx.gopParams(), input);
            }

            var output = new GraphOperatorOutput();

            if (ctx.gopOut() != null)
            {
                ParseOutput(ctx.gopOut(), output);
            }

            GraphOperatorDetail detail = null;

            if (ctx.gopDetail() != null)
            {
                var configs = new LinkedHashMap <String, Object>();
                var cfgctxs = ctx.gopDetail().gopConfig();
                foreach (var cfgctx in cfgctxs)
                {
                    String name;
                    Object value = astGraphNodeMap.Delete(cfgctx);
                    if (cfgctx.n != null)
                    {
                        name = cfgctx.n.Text;
                    }
                    else
                    {
                        name = "select";
                    }
                    configs.Put(name, value);
                }
                detail = new GraphOperatorDetail(configs);
            }

            IList <AnnotationDesc> annotations;

            if (ctx.annotationEnum() != null)
            {
                var annoctxs = ctx.annotationEnum();
                annotations = annoctxs
                              .Select(annoctx => ASTAnnotationHelper.Walk(annoctx, engineImportService))
                              .ToList();
            }
            else
            {
                annotations = Collections.GetEmptyList <AnnotationDesc>();
            }

            return(new GraphOperatorSpec(operatorName, input, output, detail, annotations));
        }