Пример #1
0
        public Term PerformOperation(Executer exec, Operator op, Term otherTerm)
        {
            //these should be in Types.Object really...
            Types.Object oThis = null;

            //TODO: if it's already been evaluated this time, no need to do it again!
            if (this.Expression!=null)
                this.Value = this.Expression.Evaluate(exec);

            oThis = this.Value;

            Types.Object oOther = null;
            if (otherTerm!=null)
            {
                //TODO: if it's already been evaluated this time, no need to do it again!
                if (otherTerm.Expression!=null)
                    otherTerm.Value = otherTerm.Expression.Evaluate(exec);

                oOther = otherTerm.Value;
            }

            //Here's the bad one: can't well set Value - what about next execution?? E.g. if it was a Variable??
            //this.Value = oThis.PerformOperation(exec, op, oOther);
            //return this.Value;
            Term tNew = new Term();
            tNew.Value = oThis.PerformOperation(exec, op, oOther);
            return tNew;
        }
Пример #2
0
 //Term term1, Term term2)
 public OperatorAndTerms(Operator op, int nTerm1Index, int nTerm2Index)
 {
     Op = op;
     Term1Index = nTerm1Index;
     Term2Index = nTerm2Index;
 }
Пример #3
0
 private void AddOperator(Operator op)
 {
     AddChunk(op);
 }
Пример #4
0
 private static void CreateOperator(Operator op)
 {
     m_htOperators.Add(op.Tokens, op);
 }