示例#1
0
 // effects: Creates a basic cell relation for query
 internal BasicCellRelation(CellQuery cellQuery, ViewCellRelation viewCellRelation,
                            IEnumerable <MemberProjectedSlot> slots)
     : base(viewCellRelation.CellNumber)
 {
     m_cellQuery = cellQuery;
     m_slots     = new List <MemberProjectedSlot>(slots);
     Debug.Assert(m_slots.Count > 0, "Cell relation with not even an exent?");
     m_viewCellRelation = viewCellRelation;
 }
示例#2
0
 // effects: Creates a basic cell relation for query
 internal BasicCellRelation(CellQuery cellQuery, ViewCellRelation viewCellRelation,
                            IEnumerable<MemberProjectedSlot> slots)
     : base(viewCellRelation.CellNumber)
 {
     m_cellQuery = cellQuery;
     m_slots = new List<MemberProjectedSlot>(slots);
     Debug.Assert(m_slots.Count > 0, "Cell relation with not even an exent?");
     m_viewCellRelation = viewCellRelation;
 }
示例#3
0
        // effects: Propagates this constraint from the basic cell relation
        // to the corresponding view cell relation and returns the new constraint
        // If all the key slots are not being projected, returns null
        internal ViewKeyConstraint Propagate()
        {
            ViewCellRelation viewCellRelation = CellRelation.ViewCellRelation;
            // If all slots appear in the projection, propagate key constraint
            List <ViewCellSlot> viewSlots = new List <ViewCellSlot>();

            foreach (MemberProjectedSlot keySlot in KeySlots)
            {
                ViewCellSlot viewCellSlot = viewCellRelation.LookupViewSlot(keySlot);
                if (viewCellSlot == null)
                {
                    // Slot is missing -- no key constraint on the view relation
                    return(null);
                }
                viewSlots.Add(viewCellSlot);
            }

            // Create a key on view relation
            ViewKeyConstraint viewKeyConstraint = new ViewKeyConstraint(viewCellRelation, viewSlots);

            return(viewKeyConstraint);
        }
示例#4
0
        private void GenerateCellRelations(int cellNumber)
        {
            // Generate the view cell relation
            List<ViewCellSlot> projectedSlots = new List<ViewCellSlot>();
            // construct a ViewCellSlot for each slot
            Debug.Assert(CQuery.NumProjectedSlots == SQuery.NumProjectedSlots,
                         "Cell queries in cell have a different number of slots");
            for (int i = 0; i < CQuery.NumProjectedSlots; i++)
            {
                ProjectedSlot cSlot = CQuery.ProjectedSlotAt(i);
                ProjectedSlot sSlot = SQuery.ProjectedSlotAt(i);
                Debug.Assert(cSlot != null, "Has cell query been normalized?");
                Debug.Assert(sSlot != null, "Has cell query been normalized?");

                // These slots better be MemberProjectedSlots. We do not have constants etc at this point.
                Debug.Assert(cSlot is MemberProjectedSlot, "cSlot is expected to be MemberProjectedSlot");
                Debug.Assert(sSlot is MemberProjectedSlot, "sSlot is expected to be MemberProjectedSlot");

                MemberProjectedSlot cJoinSlot = (MemberProjectedSlot)cSlot;
                MemberProjectedSlot sJoinSlot = (MemberProjectedSlot)sSlot;

                ViewCellSlot slot = new ViewCellSlot(i, cJoinSlot, sJoinSlot);
                projectedSlots.Add(slot);
            }
            m_viewCellRelation = new ViewCellRelation(this, projectedSlots, cellNumber);
        }
示例#5
0
 internal void CreateBasicCellRelation(ViewCellRelation viewCellRelation)
 {
     var slots = GetAllQuerySlots();
     // Create a base cell relation that has all the scalar slots of this
     m_basicCellRelation = new BasicCellRelation(this, viewCellRelation, slots);
 }