예제 #1
0
        private void InitializeFromGroupCollection(Database.Column col, long sourceColToGroup)
        {
            //create groups
            long groupCount = m_GroupCollection.GetGroupCount();

            m_Groups = new Group[groupCount];

            for (long i = 0; i < groupCount; ++i)
            {
                m_Groups[i] = new Group(m_GroupCollection.GetGroup(i).GetIndices(m_GroupCollection));
            }


            //create columns
            m_Columns = new System.Collections.Generic.List <Column>(m_Meta.GetColumnCount());
            for (int i = 0; i != m_Meta.GetColumnCount(); ++i)
            {
                var            metaCol = m_Meta.GetColumnByIndex(i);
                IGroupedColumn newCol  = (IGroupedColumn)ColumnCreator.CreateColumn(typeof(GroupedColumnTyped <>), metaCol.Type);

                newCol.Initialize(this, m_table.GetColumnByIndex(i), i, metaCol.DefaultMergeAlgorithm, i == sourceColToGroup);
                m_Columns.Add((Column)newCol);
            }
            InitGroup(groupCount);
        }
예제 #2
0
        protected void CreateColumn()
        {
            m_Columns = new System.Collections.Generic.List <Column>(m_Meta.GetColumnCount());
            for (int i = 0; i != m_Meta.GetColumnCount(); ++i)
            {
                var            metaCol = m_Meta.GetColumnByIndex(i);
                IIndexedColumn newCol  = (IIndexedColumn)ColumnCreator.CreateColumn(typeof(IndexedColumnTyped <>), metaCol.Type);

                newCol.Initialize(this, m_SourceTable.GetColumnByIndex(i));
                m_Columns.Add((Column)newCol);
            }
        }
예제 #3
0
 protected void CreateColumn()
 {
     m_Columns = new System.Collections.Generic.List <Column>(m_Meta.GetColumnCount());
     m_Columns.Add(new DiffColumnResult(this));
     for (int i = 1; i != m_Meta.GetColumnCount(); ++i)
     {
         var         metaCol = m_Meta.GetColumnByIndex(i);
         IDiffColumn newCol  = (IDiffColumn)ColumnCreator.CreateColumn(typeof(DiffColumnTyped <>), metaCol.Type);
         Column[]    c       = new Column[sourceTables.Length];
         for (int j = 0; j < sourceTables.Length; ++j)
         {
             c[j] = sourceTables[j].GetColumnByIndex(i - 1);
         }
         newCol.Initialize(this, c);
         m_Columns.Add((Column)newCol);
     }
 }
예제 #4
0
        protected System.Collections.Generic.List <Entry> Diff(MetaColumn mc, Column colA, long[] indexA, Column colB, long[] indexB)
        {
            int curA = 0;
            int curB = 0;
            int maxA = indexA.Length;
            int maxB = indexB.Length;
            var exp  = ColumnCreator.CreateTypedExpressionColumn(mc.Type, colB);

            System.Collections.Generic.List <Entry> entries = new System.Collections.Generic.List <Entry>();
            while (curA < maxA && curB < maxB)
            {
                int r = colA.Compare(indexA[curA], exp, indexB[curB]);
                switch (r)
                {
                case -1:
                    if (IsResultFilter(DiffResult.Deleted))
                    {
                        entries.Add(new Entry(DiffResult.Deleted, 0, indexA[curA]));
                    }

                    ++curA;
                    break;

                case 0:
                    if (IsResultFilter(DiffResult.Same))
                    {
                        entries.Add(new Entry(DiffResult.Same, 0, indexA[curA]));
                    }
                    ++curA;
                    ++curB;
                    break;

                case 1:

                    if (IsResultFilter(DiffResult.New))
                    {
                        entries.Add(new Entry(DiffResult.New, 1, indexB[curB]));
                    }
                    ++curB;
                    break;

                default:
                    throw new Exception("Bad compare result");
                }
            }

            if (IsResultFilter(DiffResult.Deleted))
            {
                while (curA < maxA)
                {
                    // trailing deleted entries
                    entries.Add(new Entry(DiffResult.Deleted, 0, curA));
                    ++curA;
                }
            }
            else
            {
                UnityEngine.Debug.Log("ignored entry");
            }
            if (IsResultFilter(DiffResult.New))
            {
                while (curB < maxB)
                {
                    // trailing new entries
                    entries.Add(new Entry(DiffResult.New, 1, curB));
                    ++curB;
                }
            }
            else
            {
                UnityEngine.Debug.Log("ignored entry");
            }
            return(entries);
        }