public bool Check(Soup soup, WordEntry entry) { var boundaries = new BoundariesManager(NullLogger <BoundariesManager> .Instance); boundaries.Soup = soup; return(boundaries.Check(entry)); }
/// <summary> /// Constructor /// </summary> /// <param name="options"><see cref="Options"/> used to configure this generator</param> internal SoupGenerator(Options options, IIntersectionManager intersectionManager, IBoundariesManager boundaries, ILogger <SoupGenerator> logger) { Options = options ?? throw new ArgumentNullException(nameof(options)); IntersectionManager = intersectionManager ?? throw new ArgumentNullException(nameof(intersectionManager)); Boundaries = boundaries ?? throw new ArgumentNullException(nameof(boundaries)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); Soup = new Soup(); IntersectionManager.Soup = Soup; Boundaries.Soup = Soup; LanguageData data = LoadWordsFromFile(); if (Options.Words == null) { Words = data.Lemmata; } else { Words = Options.Words; } Letters = data.Letters; AllowedDirections = GetDirections(options.AllowedDirections); if (options.Rules != null && options.Rules.Count > 0) { Rules = options.Rules; } else { Rules = StandardRules(); } }
public bool Check(Soup soup, WordEntry entry) { foreach (WordEntry item in soup.UsedWords.Values) { if (item.Direction.SameDirection(entry.Direction)) { if (item.Name.Length >= entry.Name.Length) { if (IsOverlapped(item, entry)) { return(false); } } else { if (IsOverlapped(entry, item)) { return(false); } } } } return(true); }
public bool Check(Soup soup, WordEntry entry) { return(entry.Name.Length >= _min && entry.Name.Length <= _max); }
public bool Check(Soup soup, WordEntry entry) { return(!soup.UsedWords.Keys.Contains(entry.Name)); }