示例#1
0
        public void CloneTest()
        {
            var exp   = new Exp(new Number(0));
            var clone = exp.Clone();

            Assert.Equal(exp, clone);
        }
示例#2
0
 void Push(Exp exp, Env env, Cell destination = null)
 {
     stack.Push(new Frame {
         exp = exp.Clone(), env = env, destination = destination
     });
     current = stack.Peek();
 }
示例#3
0
        /// <summary>
        /// Analyzes the specified expression.
        /// </summary>
        /// <param name="exp">The expression.</param>
        /// <returns>
        /// The result of analysis.
        /// </returns>
        public override IExpression Analyze(Exp exp)
        {
            if (!Helpers.HasVariable(exp, Variable))
            {
                return(new Number(0));
            }

            return(new Mul(exp.Argument.Clone().Analyze(this), exp.Clone()));
        }
示例#4
0
        private void btnCopy_Click(object sender, EventArgs e) // 复制
        {
            Exp copyFromExp = this.listBox1.SelectedItem as Exp;

            if (copyFromExp != null)
            {
                Exp newExp = copyFromExp.Clone() as Exp;
                this.listBox1.Items.Add(newExp);
                this.listBox1.SelectedItem = newExp;
                this.m_bChanged            = true;
            }
        }
示例#5
0
        public object Clone()
        {
            ConditionData cd = new ConditionData();

            if (datalist != null)
            {
                Exp        exp       = datalist[0] as Exp;
                List <Exp> elist     = datalist[1] as List <Exp>;
                List <Exp> elist_new = new List <Exp>();
                foreach (Exp ex in elist)
                {
                    elist_new.Add(ex.Clone() as Exp);
                }
                cd.datalist = new object[] { exp.Clone(), elist_new };
            }
            return(cd);
        }
示例#6
0
 void ReplaceCurrent(Exp exp, Env env = null)
 {
     current.ready = false;
     current.exp   = exp.Clone();
     current.env   = env ?? current.env;
 }