Example #1
0
        public SourceTable Transpose()
        {
            if (!IsTransposed)
            {
                SourceTable output = new SourceTable(Height, Width);
                output.IsTransposed = true;
                for (int i = 0; i < Width; i++)
                {
                    //List<SourceTableCell> row = new List<SourceTableCell>();

                    for (int j = 0; j < Height; j++)
                    {
                        output[j, i].Value = this[i, j].Value;
                        //  SourceTableCell cell = new SourceTableCell();

                        //row.Add(cell);
                    }

                    //Cells.Add(row);
                }
                return(output);
            }
            else
            {
                return(this);
            }
        }
Example #2
0
        public static SourceTable Load(String filepath)
        {
            var         cells  = objectSerialization.loadObjectFromXML <List <List <SourceTableCell> > >(filepath);
            SourceTable output = new SourceTable();

            output.Cells = cells;

            return(output);
        }
Example #3
0
        public SourceTable MergeAsRows(SourceTable other, Boolean OnlyDistinct = false)
        {
            var thisRows  = GetContentByRows();
            var otherRows = other.GetContentByRows();

            //var allRows = new List<List<String>>();
            //allRows.AddRange(thisRows);
            //allRows.AddRange(otherRows);

            //if (OnlyDistinct) allRows = TakeDistinct(allRows);

            //SourceTable output = new SourceTable(Width, allRows.Count);

            SourceTable output = SourceTableExtensions.Merge(new List <List <List <String> > >()
            {
                thisRows, otherRows
            }, false, OnlyDistinct);                                                                                                       //new SourceTable(allColumns.Count, Height);


            //for (int i = 0; i < output.Height; i++)
            //{
            //    var row = allRows[i];
            //    //List<SourceTableCell> row = new List<SourceTableCell>();

            //    for (int j = 0; j < output.Width; j++)
            //    {
            //        if (j < row.Count())
            //        {
            //            output[j, i].Value = row[j];
            //        }
            //        //  SourceTableCell cell = new SourceTableCell();

            //        //row.Add(cell);
            //    }

            //    //Cells.Add(row);
            //}

            return(output);
        }
Example #4
0
        public SourceTable MergeAsColumns(SourceTable other, Boolean OnlyDistinct = false)
        {
            var thisColumns  = GetContentByColumns();
            var otherColumns = other.GetContentByColumns();

            //var allColumns = new List<List<String>>();
            //allColumns.AddRange(thisColumns);
            //allColumns.AddRange(otherColumns);
            //if (OnlyDistinct) allColumns = TakeDistinct(allColumns);

            SourceTable output = SourceTableExtensions.Merge(new List <List <List <String> > >()
            {
                thisColumns, otherColumns
            }, true, OnlyDistinct);                                                                                                            //  new SourceTable(allColumns.Count, Height);

            //for (int i = 0; i < output.Width; i++)
            //{
            //    var column = allColumns[i];
            //    //List<SourceTableCell> row = new List<SourceTableCell>();

            //    for (int j = 0; j < output.Height; j++)
            //    {
            //        if (j < column.Count)
            //        {
            //            output[i, j].Value = column[j];
            //        }
            //        //  SourceTableCell cell = new SourceTableCell();

            //        //row.Add(cell);
            //    }

            //    //Cells.Add(row);
            //}

            return(output);
        }