Esempio n. 1
0
        /// <summary>
        /// Modifies a term of the expression.
        /// </summary>
        /// <param name="index">The term to modify.</param>
        /// <param name="value">The value to use to modifiy the term.</param>
        /// <param name="op">How to modify the term.</param>
        public void ModTerm(int index, int value, AlgOp op)
        {
            if (index < 0 || index >= _coeffs.Length)
            {
                return;
            }

            switch (op)
            {
            case AlgOp.ADD:
                _coeffs[index] += value;
                break;

            case AlgOp.MUL:
                _coeffs[index] *= value;
                break;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Constructs a new terminal.
 /// </summary>
 /// <param name="term">The term of the coefficient.</param>
 /// <param name="oper">The operation to perform on the coefficient.</param>
 /// <param name="val">The value to modifiy the cofficient.</param>
 public Modification(int term, AlgOp oper, int val)
 {
     _oper = oper;
     _term = term;
     _val  = val;
 }