public ExcelImporter(ICellParser cellParser)
        {
            if (cellParser == null)
            {
                throw new ArgumentNullException("cellParser");
            }

            _cellParser = cellParser;
        }
예제 #2
0
        /// <summary>
        /// Create a <see cref="FileGameInputSource"/> for the specified file
        /// and parsing method.
        /// </summary>
        /// <param name="filePath">The path to an input file.</param>
        /// <param name="cellParser">The parser to use.</param>
        public FileGameInputSource(string filePath, ICellParser cellParser)
        {
            if (string.IsNullOrWhiteSpace(filePath))
            {
                throw new ArgumentException("A file path is required.", nameof(filePath));
            }

            this.filePath   = filePath;
            this.cellParser = cellParser ?? throw new ArgumentNullException(nameof(cellParser));
        }
예제 #3
0
        public GameOfLife()
        {
            InitializeComponent();

            this.scaleFactor           = DefaultCellScale;
            this.cellScaleTextBox.Text = DefaultCellScale.ToString();

            this.generationDelayMs           = DefaultGenerationDelayMs;
            this.generationDelayTextBox.Text = DefaultGenerationDelayMs.ToString();

            this.gameStrategy = new ImmediateEvaluationForAllCellsWithAliveNeighborsGenerationStrategy();
            this.cellParser   = new TupleFormatCellParser();
        }
예제 #4
0
        /// <summary>
        /// Returns a cell value based on custom ICellFinder and ICellParser strategies
        /// </summary>
        /// <typeparam name="T">The data type for the generics cell parser</typeparam>
        /// <param name="cellFinder"></param>
        /// <param name="cellParser"></param>
        /// <returns></returns>
        public T GetCellValue <T>(ICellFinder cellFinder, ICellParser <T> cellParser)
        {
            IWebElement cell = cellFinder.FindCell(Element);

            return(cellParser.GetValue(cell));
        }
        public ExcelImporter(ICellParser cellParser)
        {
            if (cellParser == null) throw new ArgumentNullException("cellParser");

            _cellParser = cellParser;
        }
예제 #6
0
 internal ConsoleGameInputSource(ICellParser cellParser)
 {
     this.cellParser = cellParser ?? throw new ArgumentNullException(nameof(cellParser));
 }