コード例 #1
0
ファイル: frmDbConnect.cs プロジェクト: GeraldTrost/xxDevPlus
        private void loadDbMru()
        {
            ctx cx = new ctx();
            KeyPile <string, string> mruList = new KeyPile <string, string>();

            for (long i = 1; i < 10; i++)
            {
                string val = "";
                try { val = (string)(Registry.CurrentUser.CreateSubKey("SOFTWARE\\" + cx.Name + "\\DataBases").GetValue("MRU" + i)); } catch { val = ""; }
                if (val != null)
                {
                    if (val.Length > 0)
                    {
                        mruList.Add("MRU" + i, val);
                    }
                }
            }
            long j = 0;

            foreach (string key in mruList.kAsc)
            {
                j++; if (j > 9)
                {
                    break;
                }
                pupMru.Items.Add(mruList[key]);
            }
        }
コード例 #2
0
ファイル: DbSlc.cs プロジェクト: GeraldTrost/xxDevPlus
        public DbSlc(Reach smb)
        {
            Db db = new Db(new ctx().DbDrivers);

            init();
            DbSlc ret = new DbGrid(smb.before(-1, ".SL")).SLC;

            smb = smb.after(-1, ".SL");
            if (smb.startsWith("D"))
            {
                ret = ret.DST;
            }
            smb = smb.from(3);
            while (smb.len > 0)
            {
                if (smb.startsWith("DST"))
                {
                    ret = ret.DST; smb = smb.from(5); continue;
                }
                if (smb.startsWith("TOP("))
                {
                    ret = ret.TOP(long.Parse(smb.from(5).before(1, ")").text)); smb = smb.after(1, ")").from(2); continue;
                }
                if (smb.startsWith("ORD("))
                {
                    ret = ret.ORD(smb.from(5).before(1, ")").after(1, "\"").before(1, "\"").text); smb = smb.after(1, ")").from(2); continue;
                }
            }
            this.count  = ret.count;
            this.fields = ret.fields.Clone(); //new Pile<string>(ret.fieldNames);
            this.from   = new KeyPile <string, string>(ret.from);
            this.join   = ret.join.Clone();   //new Pile<Cnd>(ret.join);
            this.where  = ret.where.Clone();  //new Pile<Cnd>(ret.where);
            this.order  = ret.order;
        }
コード例 #3
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
        private static void selfTest()
        {
            selfTested = true;
            ass(new Formula("1e+2*1e-2").eval() == 1);
            ass(new Formula("1e2").eval() == 100);
            ass(new Formula("-./2").eval() == 0);
            ass(new Formula(".-2").eval() == -2);
            ass(new Formula(".e7/,5E5").eval() == 0);
            ass(new Formula(".5e7/-.5E5").eval() == -100);
            ass(new Formula("1e7/1e5").eval() == 100);
            ass(new Formula("3°2").eval() == 9);
            ass(new Formula("(3<2)^(5>4)").eval() == 1);
            ass(new Formula("3>2").eval() == 1);
            ass(new Formula("5<=2").eval() == 0);
            ass(new Formula("2+3* *  *5").eval() == 47); //AttGetr: The operator "***" sqares the first and multiplies the result with the second. this operator is defined for testing and debugging purposes only
            ass(new Formula("!!3.14159").eval() == 1);
            ass(new Formula("!!0/12").eval() == 0);
            //ass(new Formula("2 - 1 1/2").eval() == .5);
            ass(Math.Abs(new Formula("0,5+sin(45*asin(1)/90)°2").eval() - 1) < 0.0000001);
            KeyPile <string, Reach> values = new KeyPile <string, Reach>();

            values.Add("num", "4");
            values.Add("x", "-1");
            values.Add("n", "3");
            //ass(Math.Abs(new Formula(" (((2 * num --sin(-.7x)) + 2°3°-(1/2)- 2n + 1 5/6) +--1/3n * 2 1/3 * - 3 1/2 + 5(+2n+1))/-3").eval(-1, values) + 10.5548125814992) < 0.0000000001);
        }
コード例 #4
0
        public Pile <Tag> tags(long maxDepth, params Pile <string>[] cond)
        {
            KeyPile <string, Pile <NamedValue <string, Tag> > > resSet = new KeyPile <string, Pile <NamedValue <string, Tag> > >();
            KeyPile <string, Conditions> condsSet = new KeyPile <string, Conditions>();

            condsSet.Add("", new Conditions("", "", "*", cond));
            //if (resSet.Count == 0) resSet.Add("base", new Pile<Tag>());
            return(tags(maxDepth, 1, condsSet, resSet));
        }
コード例 #5
0
ファイル: DbSlc.cs プロジェクト: GeraldTrost/xxDevPlus
 private DbSlc(DbSlc cloneFrom)
 {
     init();
     this.count  = cloneFrom.count;
     this.fields = cloneFrom.fields.Clone(); //new Pile<string>(cloneFrom.fieldNames);
     this.from   = new KeyPile <string, string>(cloneFrom.from);
     this.join   = cloneFrom.join.Clone();   //new Pile<Cnd>(cloneFrom.join);
     this.where  = cloneFrom.where.Clone();  //new Pile<Cnd>(cloneFrom.where);
     this.order  = cloneFrom.order;
 }
コード例 #6
0
ファイル: DatEdit.cs プロジェクト: GeraldTrost/xxDevPlus
 public DatEdit(Control lstCtl, KeyPile <string, Control> dtlCtl, DbObj tplRec)
 {
     this.tplRec = tplRec;
     this.lstCtl = lstCtl;
     this.dtlCtl = dtlCtl;
     foreach (Control ctl in dtlCtl)
     {
         ((TextBox)(ctl)).TextChanged += dtlCtl_TextChanged;
     }
     ((ListView)(lstCtl)).SelectedIndexChanged += new System.EventHandler(lstCtl_SelectedIndexChanged);
     reloadList();
 }
コード例 #7
0
ファイル: DbUrl.cs プロジェクト: GeraldTrost/xxDevPlus
 public DbUrl(DbUrl cloneFrom)
 {
     this.drivers = cloneFrom.drivers;
     dbtec        = cloneFrom.dbtec;
     dbms         = cloneFrom.dbms;
     host         = cloneFrom.host;
     port         = cloneFrom.port;
     instance     = cloneFrom.instance;
     database     = cloneFrom.database;
     schema       = cloneFrom.schema;
     user         = cloneFrom.user;
     password     = cloneFrom.password;
     tfilter      = cloneFrom.tfilter;
     vfilter      = cloneFrom.vfilter;
 }
コード例 #8
0
ファイル: DbGrid.cs プロジェクト: GeraldTrost/xxDevPlus
        public void addTables(string tables)
        {
            tables = tables.Trim();
            while (tables.Length > 0)
            {
                string tableShort = utl.cutl(ref tables, ",").Trim().ToLower();
                tables = tables.Trim();
                string tableName = utl.cutl(ref tableShort, " ").Trim().ToLower();
                if (tableShort.Length == 0)
                {
                    tableShort = tableName;
                }
                //if ((this.tables.Len() == 0) && (tables.Length == 0)) {this.Name = tableName; this.Short = tableShort;  return; }

                if (currentState() == 0) // state is "empty", this DbGrid does not even contain a single table ...
                {
                    Name  = tableName;
                    Short = tableShort;
                    //dbdb if (db.Tables.hasKey(Name)) fields = new KeyPile<string, string>(db.Tables[Name].fields);
                    for (int i = 1; i <= fields.Len; i++)
                    {
                        fields[i] = new DbField(Short + "." + fields[i].sql());
                    }
                }
                else
                {
                    DbGrid g = new DbGrid(this);
                    if (currentState() == 1)
                    {
                        this.tables.Add(Name + " " + Short, new DbGrid(this));
                    }
                    this.tables.Add(tableName + " " + tableShort, new DbGrid(tableName + " " + tableShort));
                    Name   = "";
                    Short  = "";
                    fields = new Pile <DbField>();
                    foreach (DbGrid tab in this.tables)
                    {
                        foreach (DbField x in tab.Fields)
                        {
                            fields.Add(new DbField(tab.Short + "." + x.sql()));
                        }
                    }
                }
            }
        }
コード例 #9
0
ファイル: DbGrid.cs プロジェクト: GeraldTrost/xxDevPlus
        // Ideen:
        // Eine Projektion aus joined Tables könnte etwa so definiert werden ......
        // Join jtb = new Join("mitarbeiter m, ProcessInstance pi", "m.Id = pi.mitarbeiter");
        // Projection pjtb = jtb.Project("m.Id, m.nm, m.vorname, pi.nm, pi.Id, pi.StarDate");
        // pjtb.Select(true, "m.Id > 200", "m.nm LIKE '*Stefan*'");

        internal DbGrid(DbGrid cloneFrom)
        {
            init();
            db     = cloneFrom.db;
            fields = cloneFrom.fields.Clone(); if (cloneFrom.allFields == cloneFrom.fields)
            {
                allFields = fields;
            }
            else if (cloneFrom.allFields != null)
            {
                allFields = cloneFrom.allFields.Clone();
            }
            tables  = new KeyPile <string, DbGrid>(cloneFrom.tables);
            joinCnd = cloneFrom.joinCnd.Clone(); // new Pile<Cnd>(cloneFrom.joinCnd);
            selCnd  = cloneFrom.selCnd.Clone();  // new Pile<Cnd>(cloneFrom.selCnd);
            Name    = cloneFrom.Name;
            Short   = cloneFrom.Short;
        }
コード例 #10
0
ファイル: DbUrl.cs プロジェクト: GeraldTrost/xxDevPlus
        public DbUrl(string connectionString, KeyPile <string, string[]> drivers)
        {
            this.drivers = drivers;
            string tfilter = "";
            string vfilter = "";

            if (connectionString.IndexOf("<<") > -1)
            {
                vfilter          = connectionString;
                connectionString = utl.cutl(ref vfilter, "<<");
                tfilter          = utl.cutl(ref vfilter, "<<");
            }
            string dbms     = utl.cutl(ref connectionString, "::");
            string dbtec    = utl.cutl(ref dbms, ":");
            string instance = utl.cutl(ref connectionString, ",").Replace("\\", "/");
            string port     = utl.cutl(ref instance, "/");
            string host     = utl.cutl(ref port, ":");
            string schema   = utl.cutl(ref connectionString, ",");
            string database = utl.cutl(ref schema, "[");
            string user     = utl.cutl(ref connectionString, ",");
            string password = utl.cutl(ref connectionString, ",");

            this.dbtec    = dbtec.Trim();
            this.dbms     = dbms.Trim();
            this.host     = host.Trim();
            this.port     = long.Parse("0" + port);
            this.instance = instance.Trim();
            this.database = database.Trim();
            this.schema   = utl.cutl(ref schema, "]").Trim();
            this.user     = user.Trim();
            this.password = password.Trim();
            this.tfilter  = tfilter.Trim();
            this.vfilter  = vfilter.Trim();
            if (this.tfilter.Length == 0)
            {
                this.tfilter = "*";
            }
            if (this.vfilter.Length == 0)
            {
                this.vfilter = "*";
            }
        }
コード例 #11
0
ファイル: DbSlc.cs プロジェクト: GeraldTrost/xxDevPlus
 private void init(Pile <DbField> fields, string from, Pile <DbCnd> join, Pile <DbCnd> where)
 {
     this.count    = -1;
     this.distinct = false;
     this.order    = "";
     this.fields   = fields.Clone();
     from          = from.Trim();
     while (from.Length > 0)
     {
         string tShort = utl.cutl(ref from, ",").Trim().ToLower();
         string tName  = utl.cutl(ref tShort, " ").Trim();
         tShort = tShort.Trim(); if (tShort.Length == 0)
         {
             tShort = tName;
         }
         this.from.Add(tShort, tName);
         from = from.Trim();
     }
     this.join  = join;
     this.where = where;
 }
コード例 #12
0
ファイル: Udf.cs プロジェクト: GeraldTrost/xxDevPlus
        public string Exec(string name, string param)
        {
            string ret = "";
            string debug = ""; Tag debugDef = null; try { debugDef = new Tag(param, true).tags(2, Tag.where ("[type]==debug"))[1]; } catch (Exception ex) { } if (debugDef != null)
            {
                debug = debugDef.attr["name"].Value;
            }

            KeyPile <string, Tag>        paramSet    = new KeyPile <string, Tag>();              //Dictionary<string, Tag> paramSet = new Dictionary<string, Tag>();
            Pile <Tag>                   rsDefSet    = new Pile <Tag>();
            KeyPile <string, Conditions> rsCondSet   = new KeyPile <string, Conditions>();
            KeyPile <string, Tag>        responseSet = new KeyPile <string, Tag>();              //Dictionary<string, Tag> responseSet = new Dictionary<string, Tag>();
            KeyPile <string, Tag>        results     = new KeyPile <string, Tag>();
            KeyPile <string, Pile <NamedValue <string, Tag> > > resSet = new KeyPile <string, Pile <NamedValue <string, Tag> > >();

            string url = prepare(name, param, paramSet, rsDefSet, rsCondSet, responseSet, results, debug);

            Pile <NamedValue <string, Tag> > baseSet = new Pile <NamedValue <string, Tag> >();

            foreach (Tag t in results[1].Tags)
            {
                baseSet.Add(new NamedValue <string, Tag>("base:" + (baseSet.Len + 1), t));
            }
            resSet.Add("base", baseSet);
            results[1].tags(-1, 1, rsCondSet, resSet);
            ret += "<tr>\n<td>" + (++execCounter) + "</td></tr>\n";
            foreach (NamedValue <string, Tag> nt in resSet[-1])
            {
                ret += "<tr>\n";
                if (debug.Length == 0)
                {
                    foreach (Tag rDef in responseSet)
                    {
                        Reach val;
                        Reach valDef = rDef.attr["value"].Value.text.Replace("&lt;", "<").Replace("&gt;", ">").ToLower();
                        Reach delim  = valDef.at(1, ".");
                        if ((delim.len > 0) && (!valDef.before(delim).Equals(resSet.Keys[-1])))
                        {
                            NamedValue <string, Tag> baseTag = nt;
                            while (true)
                            {
                                Reach baseName = (Reach)baseTag.Name; int num = Int32.Parse(baseName.after(1, ":")); baseTag = resSet[baseName.before(1, ":")][num]; if (baseName.before(1, ":").Equals(valDef.before(delim)))
                                {
                                    val = baseTag.Value.val(valDef.after(delim)); break;
                                }
                            }
                        }
                        else if (delim.len > 0)
                        {
                            val = nt.Value.val(valDef.after(delim));
                        }
                        else
                        {
                            val = nt.Value.val(valDef);
                        }
                        ret += " <td>" + val.text.Replace("\n", "").Replace("\r", "") + " </td>\n";
                    }
                    ret += "</tr>\n";
                }
                else
                {
                    ret += nt.Value.struc(-1) + "</tr>\n";
                }
            }
            return("<url>" + url + "</url>" + ret);
        }
コード例 #13
0
        /*
         * internal string dbgStore()
         * {
         * string ret = "";
         * foreach (KeyValuePair<long, long> item in store)
         * {
         * long inx = (int) (item.Key >> 32);
         * if (inx < 0) inx += 1; else if (inx > 0) inx -= 1;
         * long ix = item.Value;
         * if (ix < 0) ix += 1; else if (ix > 0) ix -= 1;
         * long lbl = (int) ((item.Key & 0xFFFFFFFF) + 2147483648L);
         * ret+= "\r\n[" + inx + "," + lbl + "]    " + ix;
         * }
         * return ret.Substring(2);
         * }
         */

        private void selfTest()
        {
            selfTested = true;
            if (useReachNotify)
            {
                return;
            }
            string test = "hello world"; // will be extended to "hello new world"

            store     = new KeyPile <long, int>();
            sLabelMax = 0;
            eLabelMax = 0;

            ass(store.Len == 0);
            AddStart(1, ++sLabelMax);
            ass(store.Len == 2);
            AddEnd(11, ++eLabelMax);
            ass(store.Len == 4);

            //ass(Labels(    0,  1).Len == 0);
            //ass(Labels(   -1,  1).Len == 0);
            //ass(Labels( 2177,  1).Len == 0);
            //ass(Labels(    0, -1).Len == 0);
            //ass(Labels(   -1, -1).Len == 0);
            //ass(Labels( 2177, -1).Len == 0);



            ass(sbdry("1") == 1);
            ass(ebdry("1") == 12);
            ass(Labels(1, 1).Len == 1);
            ass(Labels(11, -1).Len == 1);
            ass(Labels(1, 1)[1] == 1);
            ass(Labels(11, -1)[1] == 1);

            test = "hello new world";
            IndexShift(7, 4, 1);
            IndexShift(7, 4, -1);
            ass(sbdry("1") == 1);
            ass(ebdry("1") == 16);
            ass(Labels(1, 1).Len == 1);
            ass(Labels(15, -1).Len == 1);
            ass(Labels(1, 1)[1] == 1);
            ass(Labels(15, -1)[1] == 1);

            AddStart(7, ++sLabelMax);
            AddEnd(9, ++eLabelMax);
            ass(sbdry("1") == 1);
            ass(sbdry("2") == 7);
            ass(ebdry("1") == 16);
            ass(ebdry("2") == 10);
            ass(Labels(1, 1).Len == 1);
            ass(Labels(7, 1).Len == 1);
            ass(Labels(9, -1).Len == 1);
            ass(Labels(15, -1).Len == 1);
            ass(Labels(1, 1)[1] == 1);
            ass(Labels(7, 1)[1] == 2);
            ass(Labels(9, -1)[1] == 2);
            ass(Labels(15, -1)[1] == 1);

            test = "he new world";
            IndexShift(3, -3, 1);
            IndexShift(3, -3, -1);
            ass(sbdry("1") == 1);
            ass(sbdry("2") == 4);
            ass(ebdry("1") == 13);
            ass(ebdry("2") == 7);
            ass(Labels(1, 1).Len == 1);
            ass(Labels(4, 1).Len == 1);
            ass(Labels(6, -1).Len == 1);
            ass(Labels(12, -1).Len == 1);
            ass(Labels(1, 1)[1] == 1);
            ass(Labels(4, 1)[1] == 2);
            ass(Labels(6, -1)[1] == 2);
            ass(Labels(12, -1)[1] == 1);

            test = "he world";
            IndexShift(4, -4, 1);
            IndexShift(4, -4, -1);
            ass(sbdry("1") == 1);
            ass(sbdry("2") == 4);
            ass(ebdry("1") == 9);
            ass(ebdry("2") == 4);
            ass(Labels(1, 1).Len == 1);
            ass(Labels(4, 1).Len == 1);
            ass(Labels(3, -1).Len == 1);
            ass(Labels(8, -1).Len == 1);
            ass(Labels(1, 1)[1] == 1);
            ass(Labels(4, 1)[1] == 2);
            ass(Labels(3, -1)[1] == 2);
            ass(Labels(8, -1)[1] == 1);

            store     = new KeyPile <long, int>();
            sLabelMax = 0;
            eLabelMax = 0;
        }
コード例 #14
0
        /*
         * internal string dbgStore()
         * {
         * string ret = "";
         * foreach (NamedItem<long, long> item in store)
         * {
         * long inx = (int) (item.Key >> 32);
         * if (inx < 0) inx += 1; else if (inx > 0) inx -= 1;
         * long ix = item.Value;
         * if (ix < 0) ix += 1; else if (ix > 0) ix -= 1;
         * long lbl = (int) ((item.Key & 0xFFFFFFFF) + 2147483648L);
         * ret+= "\r\n[" + inx + "," + lbl + "]    " + ix;
         * }
         * return ret.Substring(2);
         * }
         */

        private void selfTest()
        {
            selfTested = true;
            if (useReachNotify)
            {
                return;
            }
            string test = "hello world"; // will be extended to "hello new world"

            AddStart(1, ++sLabelMax);
            AddEnd(11, ++eLabelMax);
            ass(obdry("1") == 1);
            ass(cbdry("1") == 12);
            ass(sLabels(1).Len == 1);
            ass(eLabels(11).Len == 1);
            ass(sLabels(1)[1] == 1);
            ass(eLabels(11)[1] == 1);

            test = "hello new world";
            sIndexShift(7, 4);
            eIndexShift(7, 4);
            ass(obdry("1") == 1);
            ass(cbdry("1") == 16);
            ass(sLabels(1).Len == 1);
            ass(eLabels(15).Len == 1);
            ass(sLabels(1)[1] == 1);
            ass(eLabels(15)[1] == 1);

            AddStart(7, ++sLabelMax);
            AddEnd(9, ++eLabelMax);
            ass(obdry("1") == 1);
            ass(obdry("2") == 7);
            ass(cbdry("1") == 16);
            ass(cbdry("2") == 10);
            ass(sLabels(1).Len == 1);
            ass(sLabels(7).Len == 1);
            ass(eLabels(9).Len == 1);
            ass(eLabels(15).Len == 1);
            ass(sLabels(1)[1] == 1);
            ass(sLabels(7)[1] == 2);
            ass(eLabels(9)[1] == 2);
            ass(eLabels(15)[1] == 1);

            test = "he new world";
            sIndexShift(3, -3);
            eIndexShift(3, -3);
            ass(obdry("1") == 1);
            ass(obdry("2") == 4);
            ass(cbdry("1") == 13);
            ass(cbdry("2") == 7);
            ass(sLabels(1).Len == 1);
            ass(sLabels(4).Len == 1);
            ass(eLabels(6).Len == 1);
            ass(eLabels(12).Len == 1);
            ass(sLabels(1)[1] == 1);
            ass(sLabels(4)[1] == 2);
            ass(eLabels(6)[1] == 2);
            ass(eLabels(12)[1] == 1);

            test = "he world";
            sIndexShift(4, -4);
            eIndexShift(4, -4);
            ass(obdry("1") == 1);
            ass(obdry("2") == 4);
            ass(cbdry("1") == 9);
            ass(cbdry("2") == 4);
            ass(sLabels(1).Len == 1);
            ass(sLabels(4).Len == 1);
            ass(eLabels(3).Len == 1);
            ass(eLabels(8).Len == 1);
            ass(sLabels(1)[1] == 1);
            ass(sLabels(4)[1] == 2);
            ass(eLabels(3)[1] == 2);
            ass(eLabels(8)[1] == 1);

            store     = new KeyPile <long, long>();
            sLabelMax = 0;
            eLabelMax = 0;
        }
コード例 #15
0
ファイル: Assoc.cs プロジェクト: GeraldTrost/xxDevPlus
 public NamedValue <Reach, Reach> this[int inx] {
     get { KeyPile <string, NamedValue <Reach, Reach> > me = (KeyPile <string, NamedValue <Reach, Reach> >) this; return(me[me.Keys[inx]]); }
 }
コード例 #16
0
ファイル: DbUrl.cs プロジェクト: GeraldTrost/xxDevPlus
 public DbUrl(KeyPile <string, string[]> drivers)
 {
     this.drivers = drivers;
 }
コード例 #17
0
        internal Pile <Tag> tags(long maxDepth, long level, KeyPile <string, Conditions> condsSet, KeyPile <string, Pile <NamedValue <string, Tag> > > resSet)
        {
            long foundInThisLevel = 0;

            if (resSet.Len > 0)
            {
                if ((resSet.Len != condsSet.Len + 1))
                {
                    foreach (Conditions cnd in condsSet)
                    {
                        resSet.Add(cnd.name, new Pile <NamedValue <string, Tag> >());
                    }
                }
            }
            Pile <Tag> ret = new Pile <Tag>();

            if (condsSet.Len < level)
            {
                return(ret);
            }
            Conditions conds = condsSet[(int)level];

            //conds.reset();
            if (maxDepth == 0)
            {
                return(ret);
            }
            foreach (Tag t in _tags)
            {
                if (conds.matches(t))
                {
                    ret.Add(t);
                    string tagBase = "";
                    if (resSet.Len > 0)
                    {
                        if (conds.baseName.Length > 0)
                        {
                            if (level == 1)
                            {
                                tagBase = "base:" + ++foundInThisLevel;
                            }
                            else
                            {
                                tagBase = condsSet[(int)level - 1].name + ":" + resSet[condsSet[(int)level - 1].name].Len;
                            }
                        }
                        resSet[(int)level + 1].Add(new NamedValue <string, Tag>(tagBase, t));
                    }
                    if (level < condsSet.Len)
                    {
                        Tag baseTag = t;
                        NamedValue <string, Tag> namedBaseTag = new NamedValue <string, Tag>(tagBase, baseTag);
                        if (!condsSet[(int)level + 1].baseName.Equals(condsSet[(int)level].name))
                        {
                            Reach baseName;
                            int   num;
                            while (!condsSet[(int)level + 1].baseName.Equals(((Reach)namedBaseTag.Name).before(1, ":")))
                            {
                                baseName = (Reach)namedBaseTag.Name; num = Int32.Parse(baseName.after(1, ":")); namedBaseTag = resSet[baseName.before(1, ":")][num];
                            }
                            baseName = (Reach)namedBaseTag.Name; num = Int32.Parse(baseName.after(1, ":")); namedBaseTag = resSet[baseName.before(1, ":")][num];
                        }
                        baseTag = namedBaseTag.Value;
                        Pile <Tag> subLevelResults = null;
                        condsSet[(int)level + 1].reset();
                        subLevelResults = baseTag.tags(-1, level + 1, condsSet, resSet);
                    }
                }
                else
                {
                    Pile <Tag> subResults = null;
                    subResults = t.tags(maxDepth - 1, level, condsSet, resSet);
                    if (subResults.Len > 0)
                    {
                        ret.Add(subResults);
                    }
                }
            }
            return(ret);
        }
コード例 #18
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
        private string format(Reach term, KeyPile <string, Reach> values)
        {
            term = term.Trim();
            if (term.startsWith("+"))
            {
                return(format(term.from(2), values));
            }
            if (term.startsWith("-"))
            {
                return("-" + format(term.from(2), values));
            }
            if (term.startsWith("!"))
            {
                return("!" + format(term.from(2), values));
            }
            if (term.startsWith("«"))
            {
                return(format(Int32.Parse(term.from(2).before(1, utl.dmyBool("al(occur, token) is planned"), "»").text), values));
            }
            if (term.startsWith(true, numCharacters))
            {
                return("" + parseDouble(term));
            }
            if (term.at(1, utl.dmyBool("al(occur, token) is planned"), "«").len == 0)
            {
                try { return("" + parseDouble(values[term.text])); } catch (Exception ex) { return(term.text.Trim()); }
            }
            Reach  function = term.XTR().before(1, utl.dmyBool("al(occur, token) is planned"), "«");
            string ret      = format(Int32.Parse(term.from(2).before(1, utl.dmyBool("al(occur, token) is planned"), "»").text), values);

            if (function.equals("abs"))
            {
                return("abs(" + ret + ")");
            }
            if (function.equals("sign"))
            {
                return("sign(" + ret + ")");
            }
            if (function.equals("round"))
            {
                return("round(" + ret + ")");
            }
            if (function.equals("ceiling"))
            {
                return("ceiling(" + ret + ")");
            }
            if (function.equals("floor"))
            {
                return("floor(" + ret + ")");
            }
            if (function.equals("sqrt"))
            {
                return("sqrt(" + ret + ")");
            }
            if (function.equals("exp"))
            {
                return("exp(" + ret + ")");
            }
            if (function.equals("log"))
            {
                return("log(" + ret + ")");
            }
            if (function.equals("sin"))
            {
                return("sin(" + ret + ")");
            }
            if (function.equals("asin"))
            {
                return("asin(" + ret + ")");
            }
            if (function.equals("cos"))
            {
                return("cos(" + ret + ")");
            }
            if (function.equals("acos"))
            {
                return("acos(" + ret + ")");
            }
            if (function.equals("tan"))
            {
                return("tan(" + ret + ")");
            }
            if (function.equals("atan"))
            {
                return("atan(" + ret + ")");
            }
            if (function.equals("sinh"))
            {
                return("sinh(" + ret + ")");
            }
            if (function.equals("cosh"))
            {
                return("cosh(" + ret + ")");
            }
            if (function.equals("tanh"))
            {
                return("tanh(" + ret + ")");
            }
            return("0");
        }
コード例 #19
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
        private double eval(int inx, KeyPile <string, Reach> values)
        {
            Pile <Reach> term      = detailled(terms[inx]).split("\r\n");
            double       ret       = eval(term[1], values);
            Reach        optor     = "";
            Reach        lastOptor = "";

            for (int i = 2; i <= term.Len; i++)
            {
                if ((i % 2) == 0)
                {
                    optor = term[i];
                }
                else
                {
                    if (term[i].len == 0)
                    {
                        lastOptor = lastOptor + optor;
                    }
                    else
                    {
                        if (lastOptor.len > 0)
                        {
                            optor = lastOptor + optor; lastOptor = "";
                        }
                        double res = eval(term[i], values);
                        if (optor.equals("+"))
                        {
                            ret = ret + res;
                        }
                        else if (optor.equals("-"))
                        {
                            ret = ret - res;
                        }
                        else if (optor.equals("*"))
                        {
                            ret = ret * res;
                        }
                        else if (optor.equals("/"))
                        {
                            ret = ret / res;
                        }
                        else if (optor.equals("\\"))
                        {
                            ret = (long)(ret / res);
                        }
                        else if (optor.equals("%"))
                        {
                            ret = ret % res;
                        }
                        else if (optor.equals("°"))
                        {
                            ret = Math.Pow(ret, res);
                        }
                        else if (optor.equals("="))
                        {
                            if (Math.Abs(ret - res) < 0.00000000001)
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals(">"))
                        {
                            if (ret > res)
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals(">="))
                        {
                            if (ret >= res)
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals("<"))
                        {
                            if (ret < res)
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals("<="))
                        {
                            if (ret <= res)
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals("&"))
                        {
                            if ((not(not(ret)) == 1) && (not(not(res)) == 1))
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals("|"))
                        {
                            if ((not(not(ret)) == 1) || (not(not(res)) == 1))
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals("^"))
                        {
                            if ((not(not(ret)) == 1) ^ (not(not(res)) == 1))
                            {
                                ret = 1;
                            }
                            else
                            {
                                ret = 0;
                            }
                        }
                        else if (optor.equals("***"))
                        {
                            ret = (ret * ret) * res;           //just to demonstrate that any thinkable operation can be implemented ....
                        }
                        else
                        {
                            ret = ret;
                        }
                    }
                }
            }
            return(ret);
        }
コード例 #20
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
        private double eval(Reach term, KeyPile <string, Reach> values)
        {
            term = term.Trim();
            if (term.startsWith("+"))
            {
                return(eval(term.from(2), values));
            }
            if (term.startsWith("-"))
            {
                return(-eval(term.from(2), values));
            }
            if (term.startsWith("!"))
            {
                return(not(eval(term.from(2), values)));
            }
            if (term.startsWith("«"))
            {
                return(eval(Int32.Parse(term.from(2).before(1, utl.dmyBool("al(occur, token) is planned"), "»").text), values));
            }
            if (term.startsWith(true, numCharacters))
            {
                return(parseDouble(term));
            }
            if (term.at(1, utl.dmyBool("al(occur, token) is planned"), "«").len == 0)
            {
                return(parseDouble(values[term.text]));
            }
            Reach  function = term.XTR().before(1, utl.dmyBool("al(occur, token) is planned"), "«");
            double ret      = eval(Int32.Parse(term.from(2).before(1, utl.dmyBool("al(occur, token) is planned"), "»").text), values);

            if (function.equals("abs"))
            {
                return(Math.Abs(ret));
            }
            if (function.equals("sign"))
            {
                return(Math.Sign(ret));
            }
            if (function.equals("round"))
            {
                return(Math.Round(ret));
            }
            if (function.equals("ceiling"))
            {
                return(Math.Ceiling(ret));
            }
            if (function.equals("floor"))
            {
                return(Math.Floor(ret));
            }
            if (function.equals("sqrt"))
            {
                return(Math.Sqrt(ret));
            }
            if (function.equals("exp"))
            {
                return(Math.Exp(ret));
            }
            if (function.equals("log"))
            {
                return(Math.Log(ret));
            }
            if (function.equals("sin"))
            {
                return(Math.Sin(ret));
            }
            if (function.equals("asin"))
            {
                return(Math.Asin(ret));
            }
            if (function.equals("cos"))
            {
                return(Math.Cos(ret));
            }
            if (function.equals("acos"))
            {
                return(Math.Acos(ret));
            }
            if (function.equals("tan"))
            {
                return(Math.Tan(ret));
            }
            if (function.equals("atan"))
            {
                return(Math.Atan(ret));
            }
            if (function.equals("sinh"))
            {
                return(Math.Sinh(ret));
            }
            if (function.equals("cosh"))
            {
                return(Math.Cosh(ret));
            }
            if (function.equals("tanh"))
            {
                return(Math.Tanh(ret));
            }
            return(0);
        }
コード例 #21
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
        private string format(int inx, KeyPile <string, Reach> values)
        {
            if (terms[inx].startsWith("'") || terms[inx].startsWith("["))
            {
                return(terms[inx]);
            }
            Pile <Reach> term      = detailled(terms[inx]).split("\r\n");
            string       ret       = format(term[1], values);
            Reach        optor     = "";
            Reach        lastOptor = "";

            for (int i = 2; i <= term.Len; i++)
            {
                if ((i % 2) == 0)
                {
                    optor = term[i];
                }
                else
                {
                    if (term[i].len == 0)
                    {
                        lastOptor = lastOptor + optor;
                    }
                    else
                    {
                        if (lastOptor.len > 0)
                        {
                            optor = lastOptor + optor; lastOptor = "";
                        }
                        string res = format(term[i], values);
                        if (optor.equals("+"))
                        {
                            ret = "(" + ret + " + " + res + ")";
                        }
                        else if (optor.equals("-"))
                        {
                            ret = "(" + ret + " - " + res + ")";
                        }
                        else if (optor.equals("*"))
                        {
                            ret = "(" + ret + " * " + res + ")";
                        }
                        else if (optor.equals("/"))
                        {
                            ret = "(" + ret + " / " + res + ")";
                        }
                        else if (optor.equals("\\"))
                        {
                            ret = "(" + ret + " \\ " + res + ")";
                        }
                        else if (optor.equals("%"))
                        {
                            ret = "(" + ret + " % " + res + ")";
                        }
                        else if (optor.equals("°"))
                        {
                            ret = "(" + ret + " ° " + res + ")";
                        }
                        else if (optor.equals("="))
                        {
                            ret = "(" + ret + " = " + res + ")";
                        }
                        else if (optor.equals("=="))
                        {
                            ret = "(" + ret + " == " + res + ")";
                        }
                        else if (optor.equals(">"))
                        {
                            ret = "(" + ret + " > " + res + ")";
                        }
                        else if (optor.equals(">="))
                        {
                            ret = "(" + ret + " >= " + res + ")";
                        }
                        else if (optor.equals("<"))
                        {
                            ret = "(" + ret + " < " + res + ")";
                        }
                        else if (optor.equals("<="))
                        {
                            ret = "(" + ret + " <= " + res + ")";
                        }
                        else if (optor.equals("&"))
                        {
                            ret = "(" + ret + " & " + res + ")";
                        }
                        else if (optor.equals("&&"))
                        {
                            ret = "(" + ret + " && " + res + ")";
                        }
                        else if (optor.equals("|"))
                        {
                            ret = "(" + ret + " | " + res + ")";
                        }
                        else if (optor.equals("||"))
                        {
                            ret = "(" + ret + " || " + res + ")";
                        }
                        else if (optor.equals("~"))
                        {
                            ret = "(" + ret + " ~ " + res + ")";
                        }
                        else if (optor.equals("°"))
                        {
                            ret = "(" + ret + " ~ " + res + ")";
                        }
                        else if (optor.equals("^"))
                        {
                            ret = "(" + ret + " ° " + res + ")";
                        }
                        else if (optor.equals("***"))
                        {
                            ret = "((" + ret + " * " + ret + ") * " + res + ")";            //just to demonstrate that any thinkable operation can be implemented ....
                        }
                        else
                        {
                            ret = ret;
                        }
                    }
                }
            }
            return(ret);
        }
コード例 #22
0
ファイル: DbObj.cs プロジェクト: GeraldTrost/xxDevPlus
 protected void            initVal(int count)
 {
     val = new Pile <object>(count); map = new KeyPile <string, int>();
 }
コード例 #23
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
 public Formula(Reach expression, KeyPile <string, Reach> defaultValues)
 {
     this.defaultValues = defaultValues;
     init(expression);
 }
コード例 #24
0
ファイル: Udf.cs プロジェクト: GeraldTrost/xxDevPlus
        private string prepare(string name, string param, KeyPile <string, Tag> paramSet, Pile <Tag> rsDefSet, KeyPile <string, Conditions> rsCondSet, KeyPile <string, Tag> responseSet, KeyPile <string, Tag> results, string debug)
        {
            Tag def         = new Tag(GetParser(name, 0), true);
            Tag requestDef  = def.tags(2, new Pile <string>("", true, "[type]==request"))[1];
            Tag parserDef   = def.tags(2, new Pile <string>("", true, "[type]==parser"))[1];
            Tag responseDef = def.tags(2, new Pile <string>("", true, "[type]==response"))[1];

            KeyPile <string, Tag> resultSetDefinitions = new KeyPile <string, Tag>();
            string url = parserDef.tags(2, Tag.where ("[type]==url"))[1].txt;

            foreach (Tag t in parserDef.tags(2, Tag.where ("[type]==resultset")))
            {
                resultSetDefinitions.Add(t.attr["name"].Value.text, t);
            }

            foreach (string key in resultSetDefinitions.Keys)
            {
                rsDefSet.Add(resultSetDefinitions[key]);
            }

            foreach (Tag t in responseDef.tags(2, Tag.where ("[type]==param")))
            {
                responseSet.Add(t.attr["name"].Value.text, t);
            }
            KeyPile <long, Tag> paramList = new KeyPile <long, Tag>();

            foreach (Tag t in requestDef.tags(2, Tag.where ("[type]==param")))
            {
                paramList.Add(Int32.Parse(t.attr["key"].Value.text), t);
            }
            foreach (long key in paramList.kAsc)
            {
                paramSet.Add(paramList[key].txt.after(1, "[").before(1, "]").text, paramList[key]);
            }

            Pile <Tag> qParams = new Tag(param, true).tags(2, Tag.where ("[type]==param"));

            string[] qp = new string[qParams.Len];
            for (int i = 1; i <= qParams.Len; i++)
            {
                Tag t = qParams[i];
                qp[i - 1] = t.attr["name"].Value.text + "=" + t.attr["value"].Value.text;
            }

            foreach (string worddef in qp)
            {
                string word = worddef;
                string key  = utl.cutl(ref word, "=");
                long   pos  = 0;
                for (int i = 1; i <= paramSet.Len; i++)
                {
                    if (paramSet.Keys[i].Equals(key))
                    {
                        pos = i; break;
                    }
                }
                url = url.Replace("[" + pos + "]", paramSet[key].txt.text.Replace("[" + key + "]", word));
            }
            url = url.Replace("&amp;", "&");
            for (long i = 1; i <= paramSet.Len; i++)
            {
                url = url.Replace("[" + i + "]", "");
            }
            for (int rset = 1; rset <= rsDefSet.Len; rset++)
            {
                if (debug.Equals("base"))
                {
                    break;
                }
                Tag rsDef = rsDefSet[rset];
                Pile <Pile <string> > rsFilters = new Pile <Pile <string> >();
                foreach (Tag filterDef in rsDef.tags(2, Tag.where ("[type]==filter")))
                {
                    Pile <string> rsPatterns = new Pile <string>();
                    foreach (Tag patternDef in filterDef.tags(2, Tag.where ("[type]==pattern")))
                    {
                        bool   neg   = patternDef.attr["neg"].Value.Equals("1");
                        bool   csens = patternDef.attr["csens"].Value.Equals("1");
                        bool   rexp  = patternDef.attr["rexp"].Value.Equals("1");
                        string key   = patternDef.attr["key"].Value.text.Replace("&gt;", ">").Replace("&lt;", "<");
                        string val   = patternDef.txt;
                        string cmp   = "";
                        if (neg)
                        {
                            cmp = "!";
                        }
                        if (!csens)
                        {
                            cmp += "°";
                        }
                        if (rexp)
                        {
                            cmp += "~";
                        }
                        else
                        {
                            cmp += "=";
                        }
                        if (csens)
                        {
                            cmp += cmp.Substring(cmp.Length - 1);
                        }
                        rsPatterns.Add(key + cmp + val);
                    }
                    rsFilters.Add(rsPatterns);
                }
                rsCondSet.Add(rsDef.attr["base"].Value + "-" + rsDef.attr["name"].Value, new Conditions(rsDef.attr["base"].Value, rsDef.attr["name"].Value, rsDef.tags(2, Tag.where ("[type]==sequence"))[1].attr["include"].Value.text.Trim(), rsFilters));
                if (debug.Equals(rsDef.attr["name"].Value))
                {
                    break;
                }
                //rsCondSet.Add(rsDef.attr["base"].Item, new Conditions(rsDef.attr["base"].Item, rsDef.attr["name"].Item, rsDef.tags(2, Tag.where("[type]==sequence"))[1].attr["include"].Item.text.Trim(), rsFilters));
            }
            //long Pos1 = ((string)Reach.Load("http://www.livejasmin.com/listpage.php?page=22&livejasmin_session=4678d6bb9242e4bef687d240c293b873&tags=girl&type=40&orderby=0")).IndexOf("allonline_perfnametext");
            Tag doc = new Tag(Reach.Load(url), false);

            //long Pos2 = doc.struc(-1).IndexOf("allonline_perfnametext");
            //for (long i = 1; i <= doc.Tags.Len(); i++) doc.Tags[i].Name = "base:" + i;
            results.Add("base", doc);
            return(url);
        }
コード例 #25
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
 public double eval(KeyPile <string, Reach> values)
 {
     return(eval(-1, values));
 }
コード例 #26
0
ファイル: Udf.cs プロジェクト: GeraldTrost/xxDevPlus
        public string SourceCode(string name, long type)
        {
            Reach cSharp = new Reach("");

            cSharp = cSharp + new Reach("\n");
            cSharp = cSharp + new Reach("\n");
            cSharp = cSharp + new Reach("/**\n");
            cSharp = cSharp + new Reach(" *\n");
            cSharp = cSharp + new Reach(" * generated source code, do not change\n");
            cSharp = cSharp + new Reach(" */\n");
            cSharp = cSharp + new Reach("\n");
            cSharp = cSharp + new Reach("using System;\n");
            cSharp = cSharp + new Reach("using System.Collections.Generic;\n");
            cSharp = cSharp + new Reach("using System.Linq;\n");
            cSharp = cSharp + new Reach("using System.Text;\n");
            cSharp = cSharp + new Reach("\n");
            cSharp = cSharp + new Reach("using ndBase;\n");
            cSharp = cSharp + new Reach("using ndString;\n");
            cSharp = cSharp + new Reach("using ndData;\n");
            cSharp = cSharp + new Reach("using ndUdf;\n");
            cSharp = cSharp + new Reach("\n");
            cSharp = cSharp + new Reach("public class " + name + "Call\n");
            cSharp = cSharp + new Reach("{\n");
            cSharp = cSharp + new Reach(" private static string  parserName = \"" + name + "\";\n");
            cSharp = cSharp + new Reach(" private static bool    tested     = false;\n");
            cSharp = cSharp + new Reach(" private UdfDisp        Udf        = null;\n");
            cSharp = cSharp + new Reach("\n");

            Reach Java = new Reach("");

            Java = Java + new Reach("\n");
            Java = Java + new Reach("\n");
            Java = Java + new Reach("/**\n");
            Java = Java + new Reach(" *\n");
            Java = Java + new Reach(" * generated source code, do not change\n");
            Java = Java + new Reach(" */\n");
            Java = Java + new Reach("import org.getr.ndBase.Pile;\n");
            Java = Java + new Reach("import org.getr.ndString.Reach;\n");
            Java = Java + new Reach("import org.getr.ndData.Tag;\n");
            Java = Java + new Reach("\n");
            Java = Java + new Reach("public class " + name + "Call\n");
            Java = Java + new Reach("{\n");
            Java = Java + new Reach("\n");
            Java = Java + new Reach(" private static String  parserName = \"" + name + "\";\n");
            Java = Java + new Reach(" private static boolean tested     = false;\n");
            Java = Java + new Reach(" private UdfDisp        Udf        = null;\n");
            Java = Java + new Reach("\n");

            Tag def         = new Tag(GetParser(name, 0), true);
            Tag requestDef  = def.tags(2, new Pile <string>("", true, "[type]==request"))[1];
            Tag parserDef   = def.tags(2, new Pile <string>("", true, "[type]==parser"))[1];
            Tag responseDef = def.tags(2, new Pile <string>("", true, "[type]==response"))[1];

            KeyPile <string, Reach> rqParams = new KeyPile <string, Reach>();
            KeyPile <string, Reach> rpParams = new KeyPile <string, Reach>();

            long ctr = 0;

            while (true)
            {
                Pile <Tag> found = requestDef.tags(1, new Pile <string>("", true, "[type]==param"), new Pile <string>("", true, "key==" + (++ctr) + ""));
                if (found.Len == 0)
                {
                    break;
                }
                Tag    paramTag = found[1];
                string key      = paramTag.txt.after(1, "[").before(1, "]").text;
                string test     = "";
                if (paramTag.attr.hasKey("test"))
                {
                    test = paramTag.attr["test"].Value;
                }
                rqParams.Add(key, test);
            }

            foreach (Tag t in responseDef.tags(1, new Pile <string>("", true, "[type]==param")))
            {
                string key  = t.attr["name"].Value;
                string test = "";
                if (t.attr.hasKey("test"))
                {
                    test = t.attr["test"].Value;
                }
                rpParams.Add(key, test);
            }

            foreach (string paramName in rpParams.Keys)
            {
                cSharp = cSharp + new Reach(" private Reach m_" + Proper(paramName) + ";\n");
                Java   = Java + new Reach(" private Reach m_" + Proper(paramName) + ";\n");
            }
            cSharp = cSharp + new Reach("\n");
            Java   = Java + new Reach("\n");

            foreach (string paramName in rpParams.Keys)
            {
                cSharp = cSharp + new Reach(" public Reach " + Proper(paramName) + "                   { get { return m_" + Proper(paramName) + ";                } }\n");
                Java   = Java + new Reach(" public Reach get" + Proper(paramName) + "                () { return m_" + Proper(paramName) + ";                }\n");
            }

            cSharp = cSharp + new Reach("\n");
            Java   = Java + new Reach("\n");
            cSharp = cSharp + new Reach(" public " + name + "Call(UdfDisp Udf)\n");
            Java   = Java + new Reach(" public " + name + "Call(UdfDisp Udf) throws Exception\n");
            cSharp = cSharp + new Reach(" {\n");
            Java   = Java + new Reach(" {\n");
            cSharp = cSharp + new Reach("  this.Udf = Udf;\n");
            Java   = Java + new Reach("  this.Udf = Udf;\n");
            cSharp = cSharp + new Reach("  if (!tested)\n");
            Java   = Java + new Reach("  if (!tested)\n");
            cSharp = cSharp + new Reach("  {\n");
            Java   = Java + new Reach("  {\n");
            cSharp = cSharp + new Reach("   tested = true;\n");
            Java   = Java + new Reach("   tested = true;\n");

            string testParams = "";

            foreach (string paramName in rpParams.Keys)
            {
                testParams += rpParams[paramName].text;
            }
            if (testParams.Length == 0)
            {
                cSharp = cSharp + new Reach("  }\n");
                Java   = Java + new Reach("  }\n");
            }
            else
            {
                foreach (string paramName in rpParams.Keys)
                {
                    cSharp = cSharp + new Reach("   bool p_" + Proper(paramName) + " = false;\n");
                    Java   = Java + new Reach("   boolean p_" + Proper(paramName) + " = false;\n");
                }
                Reach execParams = new Reach("");
                foreach (Reach test in rqParams)
                {
                    execParams += new Reach("\"") + test + new Reach("\", ");
                }
                execParams = execParams.upto(-3);

                cSharp = cSharp + new Reach("   foreach (" + name + "Call res in exec( " + execParams.text + "))\n");
                Java   = Java + new Reach("   for (" + name + "Call res : exec( " + execParams.text + "))\n");
                cSharp = cSharp + new Reach("   {\n");
                Java   = Java + new Reach("   {\n");

                string passedCondition = "";
                foreach (string paramName in rpParams.Keys)
                {
                    string test = rpParams[paramName].text;
                    passedCondition += " && p_" + Proper(paramName);
                    cSharp           = cSharp + new Reach("    if (res." + Proper(paramName) + ".Equals(\"" + test + "\"))       p_" + Proper(paramName) + " = true;\n");
                    Java             = Java + new Reach("    if (res.get" + Proper(paramName) + "().Equals(\"" + test + "\"))  p_" + Proper(paramName) + " = true;\n");
                }
                passedCondition = "(!(" + passedCondition.Substring(4) + "))";
                cSharp          = cSharp + new Reach("   }\n");
                Java            = Java + new Reach("   }\n");
                cSharp          = cSharp + new Reach("   if " + passedCondition + " throw new Exception(\"" + name + "Call selfTest FAILED! Check test values in " + name + ".xml against the WebPage you get from the url! (has the html structure changed?)\");\n");
                Java            = Java + new Reach("   if " + passedCondition + " throw new Exception(\"" + name + "Call selfTest FAILED! Check test values in " + name + ".xml against the WebPage you get from the url! (has the html structure changed?)\");\n");
                cSharp          = cSharp + new Reach("  }\n");
                Java            = Java + new Reach("  }\n");
            }

            cSharp = cSharp + new Reach(" }\n");
            Java   = Java + new Reach(" }\n");
            cSharp = cSharp + new Reach("\n");
            Java   = Java + new Reach("\n");

            Reach cSharpParams = new Reach("");
            Reach javaParams   = new Reach("");

            foreach (string key in rqParams.Keys)
            {
                cSharpParams += new Reach("string ") + key + new Reach(", "); javaParams += new Reach("String ") + key + new Reach(", ");
            }
            cSharpParams = cSharpParams.upto(-3);
            javaParams   = javaParams.upto(-3);

            cSharp = cSharp + new Reach(" public Pile<" + name + "Call> exec(" + cSharpParams + ")\n");
            Java   = Java + new Reach(" public Pile<" + name + "Call> exec(" + javaParams + ") throws Exception\n");
            cSharp = cSharp + new Reach(" {\n");
            Java   = Java + new Reach(" {\n");
            cSharp = cSharp + new Reach("  string callParams = \"\";\n");
            Java   = Java + new Reach("  String callParams = \"\";\n");

            foreach (string key in rqParams.Keys)
            {
                cSharp = cSharp + new Reach("  callParams += \"<param name=\\\"" + key + "\\\" value=\\\"\" + " + key + " + \"\\\"/>\";\n");
                Java   = Java + new Reach("  callParams += \"<param name=\\\"" + key + "\\\" value=\\\"\" + " + key + " + \"\\\"/>\";\n");
            }
            cSharp = cSharp + new Reach("  Tag result = new Tag(Udf.Exec(parserName, callParams), true);\n");
            Java   = Java + new Reach("  Tag result = new Tag(Udf.exec(parserName, callParams), true);\n");
            cSharp = cSharp + new Reach("  Pile<" + name + "Call> ret = new Pile<" + name + "Call>(0);\n");
            Java   = Java + new Reach("  Pile<" + name + "Call> ret = new Pile<" + name + "Call>(0);\n");
            cSharp = cSharp + new Reach("  ret.Name = result.struc(-1);\n");
            Java   = Java + new Reach("  ret.setName(result.struc(-1));\n");
            cSharp = cSharp + new Reach("  foreach (Tag tr in result.tags(1, new Pile<string>(\"\", \"[type]==tr\")))\n");
            Java   = Java + new Reach("  for (Tag tr : result.tags(1, new Pile<String>(\"\", \"[type]==tr\")))\n");
            cSharp = cSharp + new Reach("  {\n");
            Java   = Java + new Reach("  {\n");
            cSharp = cSharp + new Reach("   " + name + "Call res = new " + name + "Call(Udf);\n");
            Java   = Java + new Reach("   " + name + "Call res = new " + name + "Call(Udf);\n");
            long rpCtr = 0;

            foreach (string key in rpParams.Keys)
            {
                rpCtr++;
                cSharp = cSharp + new Reach("   res.m_" + Proper(key) + " = tr.Tags[" + rpCtr + "].txt;\n");
                Java   = Java + new Reach("   res.m_" + Proper(key) + " = tr.Tags().get(" + rpCtr + ").txt();\n");
            }
            cSharp = cSharp + new Reach("   ret.Add(res);\n");
            Java   = Java + new Reach("   ret.add(res);\n");
            cSharp = cSharp + new Reach("  }\n");
            Java   = Java + new Reach("  }\n");
            cSharp = cSharp + new Reach("  return ret;\n");
            Java   = Java + new Reach("  return ret;\n");
            cSharp = cSharp + new Reach(" }\n");
            Java   = Java + new Reach(" }\n");
            cSharp = cSharp + new Reach("}\n");
            Java   = Java + new Reach("}\n");
            cSharp = cSharp + new Reach("\n");
            Java   = Java + new Reach("\n");
            cSharp = cSharp + new Reach("\n");
            Java   = Java + new Reach("\n");
            cSharp = cSharp + new Reach("\n");
            Java   = Java + new Reach("\n");

            switch (type)
            {
            case 1: return(cSharp.text);

            case 2: return(Java.text);
            }
            return("");
        }
コード例 #27
0
ファイル: Formula.cs プロジェクト: GeraldTrost/xxDevPlus
 public string format(KeyPile <string, Reach> values)
 {
     return(format(-1, values));
 }