public void Add(int newFactor) { InAList.Add(newFactor); if (InAList.Count > 0 && InAList.Last() > newFactor) { throw new Exception("Your list is out of order!"); } if (newFactor == lastFactor || newFactor == 2) { consecutiveFactorCounter++; } else { consecutiveFactorCounter = 0; } lastFactor = newFactor; }
public void Add(int newFactor) { InAList.Add(newFactor); if (InAList.Count > 0 && InAList.Last() > newFactor) { throw new Exception("Your list is out of order!"); } if (newFactor == lastFactor || newFactor == 2) { consecutiveFactorCounter++; } else { AsExponents.Add(new Value((double)lastFactor, (double)consecutiveFactorCounter, NumberType.exponent, Restrictions.dontFactorDontSetFraction)); consecutiveFactorCounter = 0; } lastFactor = newFactor; }