示例#1
0
        /// <summary>
        /// Collects the index of the field from memory.
        /// </summary>
        /// <param name="collector">The collector.</param>
        /// <param name="fieldSegment">The field segment.</param>
        /// <param name="index">The index.</param>
        protected void collectFieldFromMemoryIndex(TreeIndexCollector collector, FieldPathSegment fieldSegment, MemoryIndex index)
        {
            MemoryEntry entry = collector.GetMemoryEntry(index);

            this.ContainsUndefinedValue = entry.ContainsUndefinedValue;
            bool processOtherValues = false;

            IObjectValueContainer objects = collector.Structure.GetObjects(index);

            if (objects.Count > 0)
            {
                processOtherValues = entry.Count > objects.Count ||
                                     entry.ContainsUndefinedValue && entry.Count > objects.Count + 1;

                bool isMustObject = objects.Count == 1 && !processOtherValues && !entry.ContainsUndefinedValue;
                foreach (var objectValue in objects)
                {
                    collector.RootNode.CollectObject(collector, objectValue, fieldSegment);
                }

                if (entry.ContainsUndefinedValue)
                {
                    AddNewImplicitObjectNode(false);
                    collector.CollectSegmentWithoutStructure(fieldSegment, ImplicitObjectNode, false);
                }
            }
            else if (entry.ContainsUndefinedValue)
            {
                processOtherValues = entry.Count > 1;

                AddNewImplicitObjectNode(!processOtherValues);
                collector.CollectSegmentWithoutStructure(fieldSegment, ImplicitObjectNode, !processOtherValues);
            }
            else
            {
                processOtherValues = true;
            }

            if (processOtherValues)
            {
                collector.CollectFieldSegmentFromValues(fieldSegment, this, entry.PossibleValues, true);
            }
        }
示例#2
0
 public override void ProcessValues(MemoryIndex parentIndex, IEnumerable <Value> values, bool isMust)
 {
     collector.CollectFieldSegmentFromValues(fieldSegment, node, values, isMust);
 }