Example #1
0
        /// <summary>
        /// Adds the specified memory index into sources for this operation.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="System.NullReferenceException"></exception>
        public void Add(MergeOperationContext context)
        {
            if (context == null)
            {
                throw new NullReferenceException();
            }

            Indexes.Add(context);
        }
Example #2
0
 public override void addSource(MergeOperationContext operationContext, IIndexDefinition sourceDefinition)
 {
     if (sourceDefinition.Aliases != null)
     {
         references.CollectMust(sourceDefinition.Aliases.MustAliases);
         references.CollectMay(sourceDefinition.Aliases.MayAliases);
     }
     else
     {
         hasAliasesAlways = false;
     }
 }
Example #3
0
            public override void addSource(MergeOperationContext operationContext, IIndexDefinition sourceDefinition)
            {
                MemoryEntry entry;

                if (operationContext.SnapshotContext.SourceData.TryGetMemoryEntry(operationContext.Index, out entry))
                {
                    foreach (Value value in entry.PossibleValues)
                    {
                        if (!(value is AssociativeArray))
                        {
                            values.Add(value);
                        }
                    }
                }
                else
                {
                    values.Add(targetSnapshot.UndefinedValue);
                }
            }
Example #4
0
        /// <summary>
        /// Collects the source array.
        /// </summary>
        /// <param name="targetIndex">Index of the target.</param>
        /// <param name="operation">The operation.</param>
        /// <param name="operationContext">The operation context.</param>
        /// <param name="sourceArray">The source array.</param>
        public void collectSourceArray(MemoryIndex targetIndex, MergeOperation operation, MergeOperationContext operationContext, AssociativeArray sourceArray)
        {
            // Source array
            if (sourceArray != null)
            {
                // Becomes target array when not set
                if (targetArray == null && operationContext.Index.Equals(targetIndex))
                {
                    targetArray = sourceArray;
                }
                hasArray = true;

                // Save source array to merge descriptors
                IArrayDescriptor descriptor = operationContext.SnapshotContext.SourceStructure.GetDescriptor(sourceArray);
                sourceArrays.Add(new ContainerContext(operationContext.SnapshotContext, descriptor, operationContext.OperationType));

                // Equeue all array indexes when whole subtree should be merged
                if (operationContext.OperationType == MergeOperationType.WholeSubtree)
                {
                    foreach (var index in descriptor.Indexes)
                    {
                        operation.TreeNode.GetOrCreateChild(index.Key);
                    }
                    operation.TreeNode.GetOrCreateAny();
                }
            }
            else
            {
                // Source do not contain array - at least one source is empty
                arrayAlwaysDefined = false;
            }
        }