Esempio n. 1
0
        private void reload()
        {
            tblDtv.Rows.Clear();
            trm4 = new Trm(" + ", trmA, trmB, trmC, trmD);
            trm3 = new Trm(" + ", trmA, trmB, trmC);
            trm2 = new Trm(" + ", trmA, trmB);
            trm1 = new Trm(" + ", trmA);

            new Trm().Dtv.Set("x,x", ",``¹``>¹²``, ° ²``");
            new Trm().Dtv.Set("x*x", "mal``¹``>¹²``, ° ²``");

            KeyPile <string, string> dtvs = new Trm().Dtv;

            foreach (string key in dtvs.Keys)
            {
                string dtv = dtvs[key];
                if (key.StartsWith("x"))
                {
                    try
                    {
                        programGeneratedEvent++;
                        writeToTable(key, dtv);
                    }
                    finally { programGeneratedEvent--; }
                }
            }
        }
Esempio n. 2
0
 public virtual Trm apd(Trm rOpnd)
 {
     if (optor.Length > 0)
     {
         return(new Trm(this).apd(rOpnd));
     }
     this.Push(rOpnd.Clone());                               optor = utl.OPR("APD"); return(this);
 }
Esempio n. 3
0
 public virtual Trm cct(Trm rOpnd)
 {
     if (optor.Length > 0)
     {
         return(new Trm(this).cct(rOpnd));
     }
     this.Push(rOpnd.Clone());                               optor = utl.OPR("CCT"); return(this);
 }
Esempio n. 4
0
 public DbField apd(Trm rOpnd)
 {
     if (optor.Length > 0)
     {
         return(new DbField(this).apd(rOpnd));
     }
     this.Push(rOpnd.Clone());                                optor = utl.OPR("APD"); return(this);
 }
Esempio n. 5
0
 public DbField cct(Trm rOpnd)
 {
     if (optor.Length > 0)
     {
         return(new DbField(this).cct(rOpnd));
     }
     this.Push(rOpnd.Clone());                                optor = utl.OPR("CCT"); return(this);
 }
Esempio n. 6
0
 private void txtDtv_TextChanged(object sender, EventArgs e)
 {
     if (programGeneratedEvent > 0)
     {
         return;
     }
     programGeneratedEvent++;
     try
     {
         Reach dtv = txtDtv.Text;
         txtOptor.Text = dtv.before(1, " = ");
         writeToTable(txtOptor.Text, dtv.after(1, " = "));
         trm = new Trm(txtOptor.Text, txtOpnd1.Text, txtOpnd2.Text, txtOpnd3.Text, txtOpnd4.Text); //trm = new Trm(":dbg:" + txtOptor.Text, txtOpnd1.Text, txtOpnd2.Text, txtOpnd3.Text, txtOpnd4.Text);
         trm.Dtv.Set(txtOptor.Text, dtv.after(1, " = ").text);                                     //trm.Dtv.Set(":dbg:" + txtOptor.Text, dtv.after(1, " = ").text);
         try { txtVal4.Text = trm.val(); }
         catch { }
         txtOptr.Text          = trm.optr;
         txtDtv0.Text          = trm.dtv0;
         txtDtv1lR.Text        = trm.dtv1lR;
         txtDtv1mR.Text        = trm.dtv1mR;
         txtDtv1rR.Text        = trm.dtv1rR;
         txtDtv1lS.Text        = trm.dtv1lS;
         txtDtv1mS.Text        = trm.dtv1mS;
         txtDtv1rS.Text        = trm.dtv1rS;
         txtDtv2.Text          = trm.dtv2;
         chkRight2Left.Checked = !trm.left2right;
         chkRevert.Checked     = trm.revert;
         try
         {
             trm = new Trm(txtOptor.Text, txtOpnd1.Text, txtOpnd2.Text, txtOpnd3.Text);
             trm.Dtv.Set(txtOptor.Text, dtv.after(1, " = ").text); //trm.Dtv.Set(":dbg:" + txtOptor.Text, dtv.after(1, " = ").text);
             txtVal3.Text = trm.val();                             //txtVal3.Text = new Trm(":dbg:" + txtOptor.Text, txtOpnd1.Text, txtOpnd2.Text, txtOpnd3.Text).val();
             trm          = new Trm(txtOptor.Text, new object[] { txtOpnd1.Text, txtOpnd2.Text });
             trm.Dtv.Set(txtOptor.Text, dtv.after(1, " = ").text); //trm.Dtv.Set(":dbg:" + txtOptor.Text, dtv.after(1, " = ").text);
             txtVal2.Text = trm.val();                             //txtVal2.Text = new Trm(":dbg:" + txtOptor.Text, new object[] { txtOpnd1.Text, txtOpnd2.Text }).val();
             trm          = new Trm(txtOptor.Text, txtOpnd1.Text);
             trm.Dtv.Set(txtOptor.Text, dtv.after(1, " = ").text); //trm.Dtv.Set(":dbg:" + txtOptor.Text, dtv.after(1, " = ").text);
             txtVal1.Text = trm.val();                             //txtVal1.Text = new Trm(":dbg:" + txtOptor.Text, txtOpnd1.Text).val();
         }
         catch { }
     }
     finally { programGeneratedEvent--; }
 }
Esempio n. 7
0
        private void splitparts()
        {
            if (operators == null)
            {
                operators = ops.Clone(); foreach (string key in Dtv.Keys)
                {
                    operators.Push(new Reach(Dtv[key]).before(1, "``"));
                }
            }
            int inx = 1;

            while (inx <= Len)
            {
                Reach  rest = null;
                object lOp  = null;
                object rOp  = null;
                object tOp  = null;
                //if (this[inx].GetType() ==  typeof(string)) rest = new Reach((string)this[inx]).Trim();   //AttGeTr SEVERE BUGS HERE!!  the middle chars of "word" will be detected as Operator "or" !
                if (rest == null)
                {
                    inx++;
                }
                else
                {
                    Reach firstOptorSmb = rest.At(1, false, operators.array()).Trim();
                    if (firstOptorSmb.At(1, "(").len == 0)
                    {
                        if (operators.Contains((firstOptorSmb + "(").uText))
                        {
                            if (rest.after(firstOptorSmb).startsWith("("))
                            {
                                firstOptorSmb = firstOptorSmb + rest.after(firstOptorSmb).upto(1);                                                                                                                 // both the infix OR and the prefix OR( may be defined as directive
                            }
                        }
                    }
                    String firstOptor = optorForSymbolicOptor(firstOptorSmb.text);
                    if (rest.startsWith(firstOptorSmb))
                    {
                    }
                    else
                    {
                    }

                    if (firstOptorSmb.len == 0)
                    {
                        Reach fieldVal = new Reach((string)this[inx]).Trim();
                        this[inx] = new Reach((string)this[inx]);
                        rest      = "";
                    } // this term has no operand, it is a literal like 3 or a Symbol like a DbField Name or a composite field definition

                    else
                    {
                        if (rest.startsWith(firstOptorSmb))
                        {
                            if (firstOptorSmb.Equals("("))
                            {
                                this[inx] = new Trm(Zone.bracelet.on(rest).text); optor = ""; rest = rest.after(Zone.bracelet.upon(rest)).Trim();
                            }
                            else
                            {
                                string newOptor = firstOptorSmb.Trim().text.Replace("(", "");
                                bool   prefix   = (firstOptorSmb.at(1, "(").len > 0);
                                if (prefix)
                                {
                                    this[inx] = new Trm(Zone.bracelet.on(rest.after(1, optor).Trim()).text); rest = rest.after(Zone.bracelet.upon(rest.after(1, optor))).Trim();
                                }
                                else
                                {
                                    rest = "";
                                    if (optor.Length > 0)
                                    {
                                        this[1] = new Trm(optor, this[1]);
                                        for (int i = 2; i < inx; i++)
                                        {
                                            ((Trm)this[1]).Push(this[i]);
                                        }
                                        for (int i = 2; i <= Len - (inx - 2); i++)
                                        {
                                            this[i] = this[i + (inx - 2)];
                                        }
                                        for (int i = 1; i <= (inx - 2); i++)
                                        {
                                            Del(Len);
                                        }
                                        inx = 2;
                                    }
                                    this[inx] = new Trm(rest.after(1, optor).Trim().text); rest = "";
                                }
                                if ((((Trm)this[inx]).Len == 1 && ((Trm)this[inx]).optor.Length == 0))
                                {
                                    this[inx] = ((Trm)this[inx]).lOpnd;
                                }
                                optor = optorForSymbolicOptor(firstOptorSmb.Trim().text);
                            }
                        }
                        else
                        {
                            if ((Len == 1) && (optor.Length == 0))
                            {
                                optor = optorForSymbolicOptor(firstOptorSmb.Trim().text); this[inx] = rest.before(firstOptorSmb).Trim(); Push(rest.after(firstOptorSmb).Trim().text);
                            }
                            else
                            {
                                this[inx] = new Trm(optorForSymbolicOptor(firstOptorSmb.Trim().text), new object[] { rest.before(firstOptorSmb).Trim(), rest.after(firstOptorSmb).Trim().text });
                            }
                            rest = "";
                        }
                    }
                    if (rest.len > 0)
                    {
                        Push(rest.text);
                    }
                    rest = "";
                    inx++;
                }
            }
        }
Esempio n. 8
0
        }                                                                                   //the super-super class Pile already provides Clone but its result cannot be casted to (Trm) in c#

        public Trm(Trm lOpnd) : base("", lOpnd)
        {
            init();
        }
Esempio n. 9
0
 public Trm Clone()
 {
     Trm ret = new Trm(); ret.optor = optor; ret.Add(this); return(ret);
 }                                                                                   //the super-super class Pile already provides Clone but its result cannot be casted to (Trm) in c#
Esempio n. 10
0
 private void btnParseTrm_Click(object sender, EventArgs e)
 {
     try { trm = new Trm(txtNewTrm.Text); trm.Dtv.Set(txtOptor.Text, new Reach(txtDtv.Text).after(1, " = ").text); txtTrmVal.Text = trm.val(); } catch (Exception ex) { txtTrmVal.Text = "Parese Error: " + ex.Message; }
 }