Esempio n. 1
0
        public OuterTable(Table inputTable)
        {
            RawTableInformation baseTable = inputTable.ResolveToRawTable(new RawTableInformation());

            Table[]        tables = baseTable.GetTables();
            IList <long>[] rows   = baseTable.GetRows();

            outerRows = new IList <long> [rows.Length];

            // Set up the VirtualTable with this base table information,
            Init(tables);
            Set(tables, rows);
        }
Esempio n. 2
0
        /// <summary>
        /// Merges the given table in with this table.
        /// </summary>
        /// <param name="outsideTable"></param>
        public void MergeIn(Table outsideTable)
        {
            RawTableInformation rawTableInfo = outsideTable.ResolveToRawTable(new RawTableInformation());

            // Get the base information,
            Table[]        baseTables = ReferenceTables;
            IList <long>[] baseRows   = ReferenceRows;

            // The tables and rows being merged in.
            Table[]        tables = rawTableInfo.GetTables();
            IList <long>[] rows   = rawTableInfo.GetRows();
            // The number of rows being merged in.
            outerRowCount = rows[0].Count;

            for (int i = 0; i < baseTables.Length; ++i)
            {
                Table btable = baseTables[i];
                int   index  = -1;
                for (int n = 0; n < tables.Length && index == -1; ++n)
                {
                    if (btable == tables[n])
                    {
                        index = n;
                    }
                }

                // If the table wasn't found, then set 'NULL' to this base_table
                if (index == -1)
                {
                    outerRows[i] = null;
                }
                else
                {
                    List <long> list = new List <long>(outerRowCount);
                    outerRows[i] = list;
                    // Merge in the rows from the input table,
                    IList <long> toMerge = rows[index];
                    if (toMerge.Count != outerRowCount)
                    {
                        throw new ApplicationException("Wrong size for rows being merged in.");
                    }

                    list.AddRange(toMerge);
                }
            }
        }