Exemplo n.º 1
0
        IEnumerable <T> ProcessCore <T>(Func <IColumnLocation, IColumn, T> func, IColumnLocation currentLoc)
        {
            var list = new List <T> {
                func(currentLoc, this)
            };

            list.AddRange(_content.Extract(f, g));
            return(list);

            IEnumerable <T> f(IEnumerable <IRow> rows)
            {
                var results  = new List <T>();
                var rowArray = rows.Select(row => new Row(row)).ToArray();
                var rowCount = rowArray.Length;

                for (int i = 0; i < rowCount; i++)
                {
                    var colArray = rowArray[i].Columns.Select(col => new Column(col)).ToArray();
                    var colCount = colArray.Length;

                    for (int j = 0; j < colCount; j++)
                    {
                        results.AddRange(colArray[j].ProcessCore(func, currentLoc.Nest(i, j)));
                    }
                }

                return(results);
            }

            IEnumerable <T> g(object obj) => Array.Empty <T>();
        }
Exemplo n.º 2
0
        void ActOnRowsCore(Action <IRowLocation, IRow> action, IColumnLocation currentLoc)
        {
            _content.Act(f, g);

            void f(IEnumerable <IRow> rows)
            {
                var rowArray = rows.Select(row => new Row(row)).ToArray();
                var rowCount = rowArray.Length;

                for (int i = 0; i < rowCount; i++)
                {
                    action(currentLoc.NestOpen(i), rowArray[i]);

                    var colArray = rowArray[i].Columns.Select(col => new Column(col)).ToArray();
                    var colCount = colArray.Length;

                    for (int j = 0; j < colCount; j++)
                    {
                        colArray[j].ActOnRowsCore(action, currentLoc.Nest(i, j));
                    }
                }
            }

            void g(object obj)
            {
            }
        }