Beispiel #1
0
        // effects: Given the cells for the extent (extentCells) along with
        // the signatures (multiconstants + needed attributes) for this extent, generates
        // the left cell wrappers for it extent (viewTarget indicates whether
        // the view is for querying or update purposes
        // Modifies m_cellWrappers to contain this list
        private bool CreateLeftCellWrappers(IEnumerable <Cell> extentCells, ViewTarget viewTarget)
        {
            List <Cell> extentCellsList = new List <Cell>(extentCells);
            List <Cell> alignedCells    = AlignFields(extentCellsList, m_memberMaps.ProjectedSlotMap, viewTarget);

            Debug.Assert(alignedCells.Count == extentCellsList.Count, "Cell counts disagree");

            // Go through all the cells and create cell wrappers that can be used for generating the view
            m_cellWrappers = new List <LeftCellWrapper>();

            for (int i = 0; i < alignedCells.Count; i++)
            {
                Cell      alignedCell = alignedCells[i];
                CellQuery left        = alignedCell.GetLeftQuery(viewTarget);
                CellQuery right       = alignedCell.GetRightQuery(viewTarget);

                // Obtain the non-null projected slots into attributes
                Set <MemberPath> attributes = left.GetNonNullSlots();

                BoolExpression fromVariable       = BoolExpression.CreateLiteral(new CellIdBoolean(m_identifiers, extentCellsList[i].CellNumber), m_memberMaps.LeftDomainMap);
                FragmentQuery  leftFragmentQuery  = FragmentQuery.Create(fromVariable, left);
                FragmentQuery  rightFragmentQuery = FragmentQuery.Create(fromVariable, right);
                if (viewTarget == ViewTarget.UpdateView)
                {
                    leftFragmentQuery = m_leftFragmentQP.CreateDerivedViewBySelectingConstantAttributes(leftFragmentQuery) ?? leftFragmentQuery;
                }

                LeftCellWrapper leftWrapper = new LeftCellWrapper(m_viewTarget, attributes, leftFragmentQuery, left, right, m_memberMaps,
                                                                  extentCellsList[i]);
                m_cellWrappers.Add(leftWrapper);
            }
            return(true);
        }
        private bool CreateLeftCellWrappers(IList <Cell> extentCells, ViewTarget viewTarget)
        {
            List <Cell> cellList = ViewgenContext.AlignFields((IEnumerable <Cell>)extentCells, this.m_memberMaps.ProjectedSlotMap, viewTarget);

            this.m_cellWrappers = new List <LeftCellWrapper>();
            for (int index = 0; index < cellList.Count; ++index)
            {
                Cell             cell          = cellList[index];
                CellQuery        leftQuery     = cell.GetLeftQuery(viewTarget);
                CellQuery        rightQuery    = cell.GetRightQuery(viewTarget);
                Set <MemberPath> nonNullSlots  = leftQuery.GetNonNullSlots();
                FragmentQuery    fragmentQuery = FragmentQuery.Create(BoolExpression.CreateLiteral((BoolLiteral) new CellIdBoolean(this.m_identifiers, extentCells[index].CellNumber), this.m_memberMaps.LeftDomainMap), leftQuery);
                if (viewTarget == ViewTarget.UpdateView)
                {
                    fragmentQuery = this.m_leftFragmentQP.CreateDerivedViewBySelectingConstantAttributes(fragmentQuery) ?? fragmentQuery;
                }
                this.m_cellWrappers.Add(new LeftCellWrapper(this.m_viewTarget, nonNullSlots, fragmentQuery, leftQuery, rightQuery, this.m_memberMaps, extentCells[index]));
            }
            return(true);
        }