/// <summary> /// Initializes new searcher with given parameters. /// </summary> /// <param name="needleLength">The uniform length of all needles.</param> /// <param name="function">The function used to hash needles.</param> public RabinKarpSearcher(uint needleLength, IRollingHashFunction <T> function) { if (function == null) { throw new ArgumentNullException("function"); } else if (function.WindowSize != needleLength) { throw new ArgumentException("The value of function.WindowSize must be equal to needleLength."); } this.NeedleLength = needleLength; this.Needles = new List <List <T> >(); this.HashFunction = function; }
/// <summary> /// Convenience initializer so that you don't have to type so much. /// </summary> /// <param name="function">The function used to hash needles.</param> public RabinKarpSearcher(IRollingHashFunction <T> function) : this(function.WindowSize, function) { }