private void RunValidation(IPalindromeStrategy strategy) { PalindromeValidator validator = new PalindromeValidator(strategy); Stopwatch sw = new Stopwatch(); sw.Start(); int timesToRun = Convert.ToInt32(numTimesToRun.Value); bool result = false; for (int i = 0; i <= timesToRun; i++) { result = validator.IsValid(txtWord.Text); } sw.Stop(); lblResult.Text = string.Format("{0}. Took {1} ms", result ? "Palindrome word" : "Just another word", sw.ElapsedMilliseconds); }
public void Initialize() { palindromeCollection = new HashSet <string>(); substringer = new CharacterSubstringer(); validator = new PalindromeValidator(); }