コード例 #1
0
        public bool Check(Soup soup, WordEntry entry)
        {
            var boundaries = new BoundariesManager(NullLogger <BoundariesManager> .Instance);

            boundaries.Soup = soup;
            return(boundaries.Check(entry));
        }
コード例 #2
0
        /// <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();
            }
        }
コード例 #3
0
 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);
 }
コード例 #4
0
 public bool Check(Soup soup, WordEntry entry)
 {
     return(entry.Name.Length >= _min && entry.Name.Length <= _max);
 }
コード例 #5
0
 public bool Check(Soup soup, WordEntry entry)
 {
     return(!soup.UsedWords.Keys.Contains(entry.Name));
 }