public Poly Multiply(Poly p) { Poly result = new Poly(); for (int i = 0; i < units.Count; i++) { for (int j = 0; j < p.units.Count; j++) { result.Add(units[i].Multiply(p.units[j])); } } return(result); }
public Poly Parse(string line) { var listOfStringTerms = ParseToStringTerms(line); var poly = new Poly(); foreach (var stringTerm in listOfStringTerms) { var parsedTerm = ParseTerm(stringTerm); if (parsedTerm != null) { poly.Add(parsedTerm); } } return(poly); }