/// <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); } }
/// <summary> /// Collects the index of the index from memory. /// </summary> /// <param name="collector">The collector.</param> /// <param name="indexSegment">The index segment.</param> /// <param name="index">The index.</param> protected void CollectIndexFromMemoryIndex(TreeIndexCollector collector, IndexPathSegment indexSegment, MemoryIndex index) { MemoryEntry entry = collector.GetMemoryEntry(index); this.ContainsUndefinedValue = entry.ContainsUndefinedValue; bool processOtherValues = false; AssociativeArray arrayValue; if (collector.Structure.TryGetArray(index, out arrayValue)) { if (entry.ContainsUndefinedValue) { processOtherValues = entry.Count > 2; } else { processOtherValues = entry.Count > 1; } IArrayDescriptor descriptor = collector.Structure.GetDescriptor(arrayValue); collector.CollectSegmentFromStructure(indexSegment, this, descriptor, !processOtherValues); } else if (entry.ContainsUndefinedValue) { processOtherValues = entry.Count > 1; this.HasNewImplicitArray = true; collector.CollectSegmentWithoutStructure(indexSegment, this, !processOtherValues); } else { processOtherValues = true; } if (processOtherValues) { collector.CollectIndexSegmentFromValues(indexSegment, this, entry.PossibleValues, true); } }
public override void CollectIndex(TreeIndexCollector collector, IndexPathSegment indexSegment) { HasNewImplicitArray = true; collector.CollectSegmentWithoutStructure(indexSegment, this, true); }
public override void CollectField(TreeIndexCollector collector, FieldPathSegment fieldSegment) { AddNewImplicitObjectNode(true); collector.CollectSegmentWithoutStructure(fieldSegment, ImplicitObjectNode, true); }