예제 #1
0
        // add rows in this if there is a match in the other on join columns
        private DataTableLocal Semijoin(DataTableLocal other)
        {
            var cmpndx   = other.Heading.MakeIndex(Heading);
            var newtable = DataTableLocal.Create(Heading);

            foreach (var row in GetRows()) //TODO:Enumerable
            {
                if (other.HasMatch(row, cmpndx))
                {
                    newtable.AddRow(row);
                }
            }
            Logger.WriteLine(4, "[Matching={0}]", newtable);
            return(newtable);
        }
예제 #2
0
        // add rows in this if there is a match in the other on join columns
        private DataTableLocal Divide(DataTableLocal other, DataHeading newheading)
        {
            var cmpndx   = other.Heading.MakeIndex(Heading);
            var movendx  = newheading.MakeIndex(Heading);
            var newtable = DataTableLocal.Create(newheading);

            foreach (var row in GetRows()) //TODO:Enumerable
            {
                if (other.HasMatch(row, cmpndx))
                {
                    newtable.AddRow(row.Project(newheading, movendx));
                }
            }
            Logger.WriteLine(4, "[Matching={0}]", newtable);
            return(newtable);
        }