示例#1
0
 /// <summary>
 /// Select all terms accordingly with model
 /// </summary>
 /// <param name="model">model to search</param>
 /// <returns>list of elements</returns>
 public override IEnumerable <IArithmetic> Select(IArithmetic model)
 {
     if (model.ToString() == this.LeftOperand.ToString() || model.ToString() == this.RightOperand.ToString())
     {
         yield return(this);
     }
     else
     {
         foreach (IArithmetic s in this.LeftOperand.Select(model))
         {
             yield return(s);
         }
         foreach (IArithmetic s in this.RightOperand.Select(model))
         {
             yield return(s);
         }
     }
 }
 /// <summary>
 /// Select all terms accordingly with model
 /// </summary>
 /// <param name="model">model to search</param>
 /// <returns>list of elements</returns>
 public override IEnumerable <IArithmetic> Select(IArithmetic model)
 {
     if (this.Value.ToString() == model.ToString())
     {
         yield return(model);
     }
     else
     {
         yield break;
     }
 }
        /// <summary>
        /// Calculate the result of this equation
        /// terms that are valued are operated with its numeric value
        /// </summary>
        /// <param name="clean">true if calculate again</param>
        /// <returns>string representation number or algebraic</returns>
        public string Calculate(bool clean)
        {
            IArithmetic output = this.eq.Compute();

            if (output.IsDouble())
            {
                return(output.ToDouble().ToString());
            }
            else
            {
                return(output.ToString());
            }
        }
示例#4
0
 /// <summary>
 /// Select all terms accordingly with model
 /// </summary>
 /// <param name="model">model to search</param>
 /// <returns>list of elements</returns>
 public override IEnumerable <IArithmetic> Select(IArithmetic model)
 {
     foreach (IArithmetic e in this.Items)
     {
         if (model.ToString() == e.ToString())
         {
             yield return(e);
         }
         else
         {
             foreach (IArithmetic s in e.Select(model))
             {
                 yield return(s);
             }
         }
     }
 }