/// <summary> /// Tries to add A new MathItem to the exsisting problem /// </summary> /// <param name="newMathItem"></param> /// <returns></returns> private bool tryToAddNewMathItem(MathItem newMathItem) { if (newMathItem is MathValue) { return(TrytoAddnewValueItem(newMathItem as MathValue)); } else { return(TrytoAddnewOperatorItem(newMathItem as MathOperator)); } }
public bool AddToProblem(MathItem newMathItem) { if (Problem == null) { Problem = new List <MathItem>(); Problem.Add(newMathItem); return(true); } else { return(tryToAddNewMathItem(newMathItem)); } }