internal static void PropagateUpdateDomainToQueryDomain(
     IEnumerable <Cell> cells,
     MemberDomainMap queryDomainMap,
     MemberDomainMap updateDomainMap)
 {
     foreach (Cell cell in cells)
     {
         CellQuery cquery = cell.CQuery;
         CellQuery squery = cell.SQuery;
         for (int slotNum = 0; slotNum < cquery.NumProjectedSlots; ++slotNum)
         {
             MemberProjectedSlot memberProjectedSlot1 = cquery.ProjectedSlotAt(slotNum) as MemberProjectedSlot;
             MemberProjectedSlot memberProjectedSlot2 = squery.ProjectedSlotAt(slotNum) as MemberProjectedSlot;
             if (memberProjectedSlot1 != null && memberProjectedSlot2 != null)
             {
                 MemberPath memberPath1 = memberProjectedSlot1.MemberPath;
                 MemberPath memberPath2 = memberProjectedSlot2.MemberPath;
                 queryDomainMap.GetDomainInternal(memberPath1).Unite(updateDomainMap.GetDomainInternal(memberPath2).Where <Constant>((Func <Constant, bool>)(constant =>
                 {
                     if (!constant.IsNull())
                     {
                         return(!(constant is NegatedConstant));
                     }
                     return(false);
                 })));
                 if (updateDomainMap.IsConditionMember(memberPath2) && !queryDomainMap.IsConditionMember(memberPath1))
                 {
                     queryDomainMap.m_projectedConditionMembers.Add(memberPath1);
                 }
             }
         }
     }
     MemberDomainMap.ExpandNegationsInDomainMap(queryDomainMap.m_conditionDomainMap);
     MemberDomainMap.ExpandNegationsInDomainMap(queryDomainMap.m_nonConditionDomainMap);
 }
        // requires: this domainMap has been created for the C-side
        // effects: Fixes the mergedDomain map in this by merging entries
        // available in updateDomainMap
        internal static void PropagateUpdateDomainToQueryDomain(
            IEnumerable <Cell> cells, MemberDomainMap queryDomainMap, MemberDomainMap updateDomainMap)
        {
            foreach (var cell in cells)
            {
                var cQuery = cell.CQuery;
                var sQuery = cell.SQuery;

                for (var i = 0; i < cQuery.NumProjectedSlots; i++)
                {
                    var cSlot = cQuery.ProjectedSlotAt(i) as MemberProjectedSlot;
                    var sSlot = sQuery.ProjectedSlotAt(i) as MemberProjectedSlot;

                    if (cSlot == null ||
                        sSlot == null)
                    {
                        continue;
                    }

                    // Get the domain for sSlot and merge with cSlot's
                    var cPath   = cSlot.MemberPath;
                    var sPath   = sSlot.MemberPath;
                    var cDomain = queryDomainMap.GetDomainInternal(cPath);
                    var sDomain = updateDomainMap.GetDomainInternal(sPath);

                    // skip NULL because if c-side member is nullable, it's already there, and otherwise can't be taken
                    // skip negated because negated values are translated in a special way
                    cDomain.Unite(sDomain.Where(constant => !constant.IsNull() && !(constant is NegatedConstant)));

                    if (updateDomainMap.IsConditionMember(sPath) &&
                        !queryDomainMap.IsConditionMember(cPath))
                    {
                        // record this member so KB knows we have to generate constraints for it
                        queryDomainMap.m_projectedConditionMembers.Add(cPath);
                    }
                }
            }

            ExpandNegationsInDomainMap(queryDomainMap.m_conditionDomainMap);
            ExpandNegationsInDomainMap(queryDomainMap.m_nonConditionDomainMap);
        }
        // requires: this domainMap has been created for the C-side
        // effects: Fixes the mergedDomain map in this by merging entries
        // available in updateDomainMap
        internal static void PropagateUpdateDomainToQueryDomain(
            IEnumerable<Cell> cells, MemberDomainMap queryDomainMap, MemberDomainMap updateDomainMap)
        {
            foreach (var cell in cells)
            {
                var cQuery = cell.CQuery;
                var sQuery = cell.SQuery;

                for (var i = 0; i < cQuery.NumProjectedSlots; i++)
                {
                    var cSlot = cQuery.ProjectedSlotAt(i) as MemberProjectedSlot;
                    var sSlot = sQuery.ProjectedSlotAt(i) as MemberProjectedSlot;

                    if (cSlot == null
                        || sSlot == null)
                    {
                        continue;
                    }

                    // Get the domain for sSlot and merge with cSlot's
                    var cPath = cSlot.MemberPath;
                    var sPath = sSlot.MemberPath;
                    var cDomain = queryDomainMap.GetDomainInternal(cPath);
                    var sDomain = updateDomainMap.GetDomainInternal(sPath);

                    // skip NULL because if c-side member is nullable, it's already there, and otherwise can't be taken
                    // skip negated because negated values are translated in a special way
                    cDomain.Unite(sDomain.Where(constant => !constant.IsNull() && !(constant is NegatedConstant)));

                    if (updateDomainMap.IsConditionMember(sPath)
                        && !queryDomainMap.IsConditionMember(cPath))
                    {
                        // record this member so KB knows we have to generate constraints for it
                        queryDomainMap.m_projectedConditionMembers.Add(cPath);
                    }
                }
            }

            ExpandNegationsInDomainMap(queryDomainMap.m_conditionDomainMap);
            ExpandNegationsInDomainMap(queryDomainMap.m_nonConditionDomainMap);
        }