Esempio n. 1
0
        /// <summary>
        /// Makes the aliases.
        /// </summary>
        /// <param name="collector">The collector.</param>
        /// <param name="data">The data.</param>
        private void makeAliases(IIndexCollector collector, AliasData data)
        {
            //Must target
            foreach (MemoryIndex index in collector.MustIndexes)
            {
                snapshot.MustSetAliases(index, data.MustIndexes, data.MayIndexes);
            }

            //Must source
            foreach (MemoryIndex index in data.MustIndexes)
            {
                snapshot.AddAliases(index, collector.MustIndexes, collector.MayIndexes);
            }

            //May target
            HashSet <MemoryIndex> sourceAliases = new HashSet <MemoryIndex>(data.MustIndexes.Concat(data.MayIndexes));

            foreach (MemoryIndex index in collector.MayIndexes)
            {
                snapshot.MaySetAliases(index, sourceAliases);
            }

            //May source
            HashSet <MemoryIndex> targetAliases = new HashSet <MemoryIndex>(collector.MustIndexes.Concat(collector.MayIndexes));

            foreach (MemoryIndex index in data.MayIndexes)
            {
                snapshot.AddAliases(index, null, targetAliases);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Makes the aliases.
        /// </summary>
        /// <param name="sourceCollector">The source collector.</param>
        /// <param name="targetCollector">The target collector.</param>
        private void makeAliases(IIndexCollector sourceCollector, IIndexCollector targetCollector)
        {
            if (snapshot.AssignInfo == null)
            {
                snapshot.AssignInfo = new AssignInfo();
            }

            //Must target
            foreach (MemoryIndex index in targetCollector.MustIndexes)
            {
                snapshot.MustSetAliases(index, sourceCollector.MustIndexes, sourceCollector.MayIndexes);

                //Must source
                foreach (MemoryIndex alias in sourceCollector.MustIndexes)
                {
                    if (!alias.Equals(index))
                    {
                        snapshot.AssignInfo.AliasAssignModifications.GetOrCreateModification(index).AddDatasource(alias, snapshot);
                    }
                }

                //May source
                foreach (MemoryIndex alias in sourceCollector.MayIndexes)
                {
                    if (!alias.Equals(index))
                    {
                        snapshot.AssignInfo.AliasAssignModifications.GetOrCreateModification(index).AddDatasource(alias, snapshot);
                    }
                }
            }

            //Must source
            foreach (MemoryIndex index in sourceCollector.MustIndexes)
            {
                snapshot.AddAliases(index, targetCollector.MustIndexes, targetCollector.MayIndexes);
            }

            //May target
            HashSet <MemoryIndex> sourceAliases = new HashSet <MemoryIndex>(sourceCollector.MustIndexes.Concat(sourceCollector.MayIndexes));

            foreach (MemoryIndex index in targetCollector.MayIndexes)
            {
                snapshot.MaySetAliases(index, sourceAliases);
            }

            //May source
            HashSet <MemoryIndex> targetAliases = new HashSet <MemoryIndex>(targetCollector.MustIndexes.Concat(targetCollector.MayIndexes));

            foreach (MemoryIndex index in sourceCollector.MayIndexes)
            {
                snapshot.AddAliases(index, null, targetAliases);
            }
        }