public FunctionContext(string param_, int no_, long funcno_, ColumnDataGenerator gen)
            : base(param_, no_)
        {
            string eval = gen.funcsDict[funcno_];

            //this.Funcname = funcName_;

            //関数名
            Regex regex = new System.Text.RegularExpressions.Regex(@"([a-zA-Z0-9]+)[\(].*[\)]");
            MatchCollection matchCol = regex.Matches(eval);

            if (matchCol.Count > 0 && matchCol[0].Groups.Count > 1)
            {
                this.Funcname = matchCol[0].Groups[1].Value;
                //MessageBox.Show("Func:" + this.Funcname);
                MyLogSingleton.getIncetance().DoLogWithDate(TraceEventType.Verbose, 1,"Func:"+this.Funcname);

                //this.InnerGen = new ContextColumnDataGenerator(this.Funcname, this.innerCol);
            }

            ArgSelector asel = new ArgSelector();
            this.Args = asel.SelectArgs(eval.Substring(this.Funcname.Length),1);

            foreach (string arg in this.Args)
            {
                //MessageBox.Show("Arg:"+arg);
                MyLogSingleton.getIncetance().DoLogWithDate(TraceEventType.Verbose, 1, "Arg:" + arg);
            }

            //引数部取得
            string inner = eval.Replace(this.Funcname + "(", "");
            inner = inner.Substring(0, inner.Length - 1);

            //引数部
            /*
            Regex regex2 = new System.Text.RegularExpressions.Regex(@"([a-zA-Z0-9]+[\(][^\)]*[\)])");
            MatchCollection matchCol2 = regex2.Matches(inner);

            string proccessedParam = inner;
            long funcNo = 1;

            if (matchCol2.Count > 0 && matchCol2[0].Groups.Count > 1)
            {
                foreach (Match m in matchCol2)
                {
                    //this.innerCol = matchCol2[0].Groups[1].Value;

                    MessageBox.Show("innerFunc:" + m.Groups[1].Value);

                    string func = m.Groups[1].Value;
                    string funcID = ContextMaxFunctionDataGenerator.funcHeader + funcNo.ToString();

                    proccessedParam = proccessedParam.Replace(func, funcID);
                    this.funcsDict.Add(funcNo, func);

                    funcNo++;

                }

            }
             */

            //Regex regexMin = new System.Text.RegularExpressions.Regex(@"([a-zA-Z0-9]+[\(][^\)]*[\)])+");
            //MatchCollection matchColMin = regexMin.Matches(inner);

            FunctionSelector sel = new FunctionSelector();

            List<string> funcs = sel.SelectFunctions(inner, 1);

            //if (matchColMin.Count > 0 && matchColMin[0].Groups.Count > 1)
            if( funcs.Count > 0 )
            {
                //MessageBox.Show("min");
                MyLogSingleton.getIncetance().DoLogWithDate(TraceEventType.Verbose, 1, "min:");
                this.InnerMinGen = new ContextMinFunctionDataGenerator("", inner);
            }
            else
            {
                //MessageBox.Show("max");
                MyLogSingleton.getIncetance().DoLogWithDate(TraceEventType.Verbose, 1, "max:");
                this.InnerMaxGen = new ContextMaxFunctionDataGenerator("", inner);
            }

            /*
            if (this.Funcname != null && this.innerCol != null)
            {
                this.InnerGen = new ContextMinFunctionDataGenerator(this.Funcname, this.innerCol);
            }
            */
        }
Esempio n. 2
0
 public Context Create(string funcParam, int no_, long funcno_, ColumnDataGenerator gen)
 {
     return new FunctionContext(funcParam, no_, funcno_, gen);
 }