Example #1
0
        public Obj Copy(int idx1, int idx2, int idx3)
        {
            if (count == 0)
            {
                return(EmptyRelObj.Singleton());
            }

            Obj[] objs1 = new Obj[count];
            Obj[] objs2 = new Obj[count];
            Obj[] objs3 = new Obj[count];

            int len  = tuples.Length;
            int next = 0;

            for (uint i = 0; i < len; i++)
            {
                Tuple tuple = tuples[i];
                if (tuple.field2OrEmptyMarker != Tuple.Empty)
                {
                    objs1[next] = store1.GetValue(tuple.field1OrNext);
                    objs2[next] = store2.GetValue(tuple.field2OrEmptyMarker);
                    objs3[next] = store3.GetValue(tuple.field3);
                    next++;
                }
            }
            Miscellanea.Assert(next == count);

            Obj[][] cols = new Obj[3][];
            cols[idx1] = objs1;
            cols[idx2] = objs2;
            cols[idx3] = objs3;

            return(Builder.CreateTernRel(cols[0], cols[1], cols[2], count));
        }
Example #2
0
        public Obj Copy(bool flipped)
        {
            int count = table1.count;

            if (count == 0)
            {
                return(EmptyRelObj.Singleton());
            }

            Obj[] objs1 = new Obj[count];
            Obj[] objs2 = new Obj[count];

            int next = 0;

            for (uint i = 0; i < table1.column.Length; i++)
            {
                uint code = table1.column[i];
                if (code != OverflowTable.EmptyMarker)
                {
                    Obj val1 = store1.GetValue(i);
                    if (code >> 29 == 0)
                    {
                        objs1[next]   = val1;
                        objs2[next++] = store2.GetValue(code);
                    }
                    else
                    {
                        OverflowTable.Iter it = table1.overflowTable.GetIter(code);
                        while (!it.Done())
                        {
                            uint surr2 = it.Get();
                            objs1[next]   = val1;
                            objs2[next++] = store2.GetValue(surr2);
                            it.Next();
                        }
                    }
                }
            }
            Miscellanea.Assert(next == count);

            return(Builder.CreateBinRel(flipped ? objs2 : objs1, flipped ? objs1 : objs2, count)); //## THIS COULD BE MADE MORE EFFICIENT
        }
Example #3
0
        public Obj Copy()
        {
            if (count == 0)
            {
                return(EmptyRelObj.Singleton());
            }
            Obj[] objs = new Obj[count];
            int   next = 0;

            for (uint i = 0; i < bitmap.Length; i++)
            {
                ulong mask = bitmap[i];
                for (uint j = 0; j < 64; j++)
                {
                    if (((mask >> (int)j) & 1) != 0)
                    {
                        objs[next++] = store.GetValue(j + 64 * i);
                    }
                }
            }
            Miscellanea.Assert(next == count);
            return(Builder.CreateSet(objs, objs.Length));
        }