/// <summary> /// Analyzes the specified URL list. /// </summary> /// <param name="urlList">The URL list.</param> public void Analyze(IEnumerable <String> urlList) { CommonPrefix = urlList.commonStartSubstring(0); List <String> inverted_list = new List <string>(); foreach (String url in urlList) { inverted_list.Add(url.Inverse()); } CommonSufix = inverted_list.commonStartSubstring(0); CommonSufix = CommonSufix.Inverse(); }
/// <summary> /// Determines whether this instance is configured /// </summary> /// <returns> /// <c>true</c> if this instance is set; otherwise, <c>false</c>. /// </returns> public Boolean IsSet() { if (!CommonSufix.isNullOrEmpty()) { return(true); } if (!CommonPrefix.isNullOrEmpty()) { return(true); } return(false); }
/// <summary> /// Determines whether the specified URL is match /// </summary> /// <param name="url">The URL.</param> /// <returns> /// <c>true</c> if the specified URL is match; otherwise, <c>false</c>. /// </returns> public Boolean IsMatch(String url) { Boolean output = false; if (!CommonSufix.isNullOrEmpty()) { output = url.EndsWith(CommonSufix); if (output) { output = url.StartsWith(CommonPrefix); } } else { output = url.StartsWith(CommonPrefix); } return(output); }