Exemplo n.º 1
0
        // <summary>
        // See <see cref="BoolLiteral.GetRequiredSlots" />.
        // </summary>
        internal override void GetRequiredSlots(MemberProjectionIndex projectedSlotMap, bool[] requiredSlots)
        {
            // Simply get the slot for the variable var in "var in values"
            var member  = RestrictedMemberSlot.MemberPath;
            var slotNum = projectedSlotMap.IndexOf(member);

            requiredSlots[slotNum] = true;
        }
        internal override void GetRequiredSlots(
            MemberProjectionIndex projectedSlotMap,
            bool[] requiredSlots)
        {
            MemberPath memberPath = this.RestrictedMemberSlot.MemberPath;
            int        index      = projectedSlotMap.IndexOf(memberPath);

            requiredSlots[index] = true;
        }
Exemplo n.º 3
0
        // requires: projectedSlotMap which contains a mapping of the fields
        // for "this" to integers
        // effects: Align the fields of this cell query using the
        // projectedSlotMap and generates a new query into newMainQuery
        // Based on the re-aligned fields in this, re-aligns the
        // corresponding fields in otherQuery as well and modifies
        // newOtherQuery to contain it
        // Example:
        //    input:  Proj[A,B,"5"] = Proj[F,"7",G]
        //            Proj[C,B]     = Proj[H,I]
        //            projectedSlotMap: A -> 0, B -> 1, C -> 2
        //   output:  Proj[A,B,null] = Proj[F,"7",null]
        //            Proj[null,B,C] = Proj[null,I,H]
        internal void CreateFieldAlignedCellQueries(
            CellQuery otherQuery, MemberProjectionIndex projectedSlotMap,
            out CellQuery newMainQuery, out CellQuery newOtherQuery)
        {
            // mainSlots and otherSlots hold the new slots for two queries
            var numAlignedSlots = projectedSlotMap.Count;
            var mainSlots       = new ProjectedSlot[numAlignedSlots];
            var otherSlots      = new ProjectedSlot[numAlignedSlots];

            // Go through the slots for this query and find the new slot for them
            for (var i = 0; i < m_projectedSlots.Length; i++)
            {
                var slot = m_projectedSlots[i] as MemberProjectedSlot;
                Debug.Assert(slot != null, "All slots during cell normalization must field slots");
                // Get the the ith slot's variable and then get the
                // new slot number from the field map
                var newSlotNum = projectedSlotMap.IndexOf(slot.MemberPath);
                Debug.Assert(newSlotNum >= 0, "Field projected but not in projectedSlotMap");
                mainSlots[newSlotNum]  = m_projectedSlots[i];
                otherSlots[newSlotNum] = otherQuery.m_projectedSlots[i];

                // We ignore constants -- note that this is not the
                // isHighpriority or discriminator case.  An example of this
                // is when (say) Address does not have zip but USAddress
                // does.  Then the constraint looks like Pi_NULL, A, B(E) =
                // Pi_x, y, z(S)

                // We don't care about this null in the view generation of
                // the left side. Note that this could happen in inheritance
                // or in cases when say the S side has 20 fields but the C
                // side has only 3 - the other 17 are null or default.

                // NOTE: We allow such constants only on the C side and not
                // ont the S side. Otherwise, we can have a situation Pi_A,
                // B, C(E) = Pi_5, y, z(S) Then someone can set A to 7 and we
                // will not roundtrip. We check for this in validation
            }

            // Make the new cell queries with the new slots
            newMainQuery  = new CellQuery(this, mainSlots);
            newOtherQuery = new CellQuery(otherQuery, otherSlots);
        }
        internal void CreateFieldAlignedCellQueries(
            CellQuery otherQuery,
            MemberProjectionIndex projectedSlotMap,
            out CellQuery newMainQuery,
            out CellQuery newOtherQuery)
        {
            int count = projectedSlotMap.Count;

            ProjectedSlot[] newSlots1 = new ProjectedSlot[count];
            ProjectedSlot[] newSlots2 = new ProjectedSlot[count];
            for (int index1 = 0; index1 < this.m_projectedSlots.Length; ++index1)
            {
                MemberProjectedSlot projectedSlot = this.m_projectedSlots[index1] as MemberProjectedSlot;
                int index2 = projectedSlotMap.IndexOf(projectedSlot.MemberPath);
                newSlots1[index2] = this.m_projectedSlots[index1];
                newSlots2[index2] = otherQuery.m_projectedSlots[index1];
            }
            newMainQuery  = new CellQuery(this, newSlots1);
            newOtherQuery = new CellQuery(otherQuery, newSlots2);
        }
Exemplo n.º 5
0
        // requires: projectedSlotMap which contains a mapping of the fields
        // for "this" to integers 
        // effects: Align the fields of this cell query using the
        // projectedSlotMap and generates a new query into newMainQuery
        // Based on the re-aligned fields in this, re-aligns the
        // corresponding fields in otherQuery as well and modifies
        // newOtherQuery to contain it
        // Example:
        //    input:  Proj[A,B,"5"] = Proj[F,"7",G]
        //            Proj[C,B]     = Proj[H,I]
        //            projectedSlotMap: A -> 0, B -> 1, C -> 2
        //   output:  Proj[A,B,null] = Proj[F,"7",null]
        //            Proj[null,B,C] = Proj[null,I,H]
        internal void CreateFieldAlignedCellQueries(
            CellQuery otherQuery, MemberProjectionIndex projectedSlotMap,
            out CellQuery newMainQuery, out CellQuery newOtherQuery)
        {
            // mainSlots and otherSlots hold the new slots for two queries
            var numAlignedSlots = projectedSlotMap.Count;
            var mainSlots = new ProjectedSlot[numAlignedSlots];
            var otherSlots = new ProjectedSlot[numAlignedSlots];

            // Go through the slots for this query and find the new slot for them
            for (var i = 0; i < m_projectedSlots.Length; i++)
            {
                var slot = m_projectedSlots[i] as MemberProjectedSlot;
                Debug.Assert(slot != null, "All slots during cell normalization must field slots");
                // Get the the ith slot's variable and then get the
                // new slot number from the field map
                var newSlotNum = projectedSlotMap.IndexOf(slot.MemberPath);
                Debug.Assert(newSlotNum >= 0, "Field projected but not in projectedSlotMap");
                mainSlots[newSlotNum] = m_projectedSlots[i];
                otherSlots[newSlotNum] = otherQuery.m_projectedSlots[i];

                // We ignore constants -- note that this is not the
                // isHighpriority or discriminator case.  An example of this
                // is when (say) Address does not have zip but USAddress
                // does.  Then the constraint looks like Pi_NULL, A, B(E) =
                // Pi_x, y, z(S)

                // We don't care about this null in the view generation of
                // the left side. Note that this could happen in inheritance
                // or in cases when say the S side has 20 fields but the C
                // side has only 3 - the other 17 are null or default.

                // NOTE: We allow such constants only on the C side and not
                // ont the S side. Otherwise, we can have a situation Pi_A,
                // B, C(E) = Pi_5, y, z(S) Then someone can set A to 7 and we
                // will not roundtrip. We check for this in validation
            }

            // Make the new cell queries with the new slots
            newMainQuery = new CellQuery(this, mainSlots);
            newOtherQuery = new CellQuery(otherQuery, otherSlots);
        }
 /// <summary>
 /// See <see cref="BoolLiteral.GetRequiredSlots"/>.
 /// </summary>
 internal override void GetRequiredSlots(MemberProjectionIndex projectedSlotMap, bool[] requiredSlots)
 {
     // Simply get the slot for the variable var in "var in values"
     var member = RestrictedMemberSlot.MemberPath;
     var slotNum = projectedSlotMap.IndexOf(member);
     requiredSlots[slotNum] = true;
 }