public void Add(Bead bead) { if (Accepts(bead)) { if (BeadThreshold.HasValue) { if (beadsCount < BeadThreshold.Value) { beadsCount++; } else { string higherRankedSymbol = GetHigherRankedSymbol(bead.Symbol); if (higherRankedSymbol == null) { beadsCount++; } else { beadsCount = 1; UpperRode.Add(new Bead(higherRankedSymbol)); } } } else { beadsCount++; } } else if (UpperRode != null) { UpperRode.Add(bead); } }
public void Add(Bead bead) { if (Accepts(bead)) { if (BeadThreshold.HasValue) { if (beadsCount < BeadThreshold.Value) { beadsCount++; } else { string higherRankedSymbol = GetHigherRankedSymbol(bead.Symbol); if (higherRankedSymbol == null) { beadsCount++; } else { beadsCount = 1; UpperRode.Add(new Bead(higherRankedSymbol)); } } } else { beadsCount++; } } else if (UpperRode != null) { UpperRode.Add(bead); } }
private static Bead[] CreateBeads(char symbol, int count = 1) { Bead[] array = new Bead[count]; for (int index = 0; index < count; index++) { array[index] = new Bead(symbol.ToString(CultureInfo.InvariantCulture)); } return(array); }
protected override bool Accepts(Bead bead) { return Symbol.Equals(bead.Symbol, StringComparison.InvariantCulture); }
protected override bool Accepts(Bead bead) { return(Symbol.Equals(bead.Symbol, StringComparison.InvariantCulture)); }
protected abstract bool Accepts(Bead bead);
public void Constructor_UsingValidSymbol_DoesNotThrowException() { Bead bead = new Bead("symbol"); }
public void Constructor_UsingInvalidSymbol_ThrowsException( [ValueSource(typeof (SymbolGenerator), "GetNullEmptyAndWhitespaceStrings")] string nullEmptyOrWhitespaceString) { Bead bead = new Bead(nullEmptyOrWhitespaceString); }
protected override bool Accepts(Bead bead) { return(allDigits.All(digit => digit.Equals(bead.Symbol, StringComparison.InvariantCulture))); }
private static Bead[] CreateBeads(char symbol, int count = 1) { Bead[] array = new Bead[count]; for (int index = 0; index < count; index++) { array[index] = new Bead(symbol.ToString(CultureInfo.InvariantCulture)); } return array; }
protected override bool Accepts(Bead bead) { return allDigits.All(digit => digit.Equals(bead.Symbol, StringComparison.InvariantCulture)); }
protected abstract bool Accepts(Bead bead);