Beispiel #1
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();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="options"><see cref="Options"/> used to configure this generator</param>
 public SoupGenerator(IOptions <Options> options, IIntersectionManager intersectionManager, IBoundariesManager boundaries, ILogger <SoupGenerator> logger) :
     this(options?.Value, intersectionManager, boundaries, logger)
 {
 }
Beispiel #3
0
 public TestDataGenerator(IBoundariesManager boundaries, IIntersectionManager intersections)
 {
     _boundaries    = boundaries ?? throw new ArgumentNullException(nameof(boundaries));
     _intersections = intersections ?? throw new ArgumentNullException(nameof(boundaries));
 }