/// <summary> /// Processes the index - traverse thru array or sets path to undefined. /// </summary> /// <param name="parentIndex">Index of the parent.</param> /// <param name="indexSegment">The index segment.</param> /// <param name="visitor">The visitor to process scalar values.</param> private void processIndex(MemoryIndex parentIndex, IndexPathSegment indexSegment, ProcessValueAsLocationVisitor visitor) { MemoryEntry entry; if (snapshot.Data.TryGetMemoryEntry(parentIndex, out entry)) { bool processOtherValues = false; AssociativeArray arrayValue; if (snapshot.Structure.TryGetArray(parentIndex, out arrayValue)) { ArrayDescriptor descriptor = snapshot.Structure.GetDescriptor(arrayValue); process(indexSegment, descriptor); processOtherValues = entry.Count > 1; } else if (entry.Count > 0) { processOtherValues = true; } else { IsDefined = false; } if (processOtherValues) { visitor.ProcessValues(parentIndex, entry.PossibleValues, true); } } else { IsDefined = false; } }
/// <summary> /// Processes the field - traverse thru all containing objects or sets path to undefined. /// </summary> /// <param name="parentIndex">Index of the parent.</param> /// <param name="fieldSegment">The field segment.</param> /// <param name="visitor">The visitor to process scalar values.</param> private void processField(MemoryIndex parentIndex, FieldPathSegment fieldSegment, ProcessValueAsLocationVisitor visitor) { MemoryEntry entry; if (snapshot.Data.TryGetMemoryEntry(parentIndex, out entry)) { bool processOtherValues = false; ObjectValueContainer objectValues = snapshot.Structure.GetObjects(parentIndex); if (objectValues.Count > 0) { foreach (ObjectValue objectValue in objectValues) { ObjectDescriptor descriptor = snapshot.Structure.GetDescriptor(objectValue); process(fieldSegment, descriptor); } processOtherValues = entry.Count > objectValues.Count; } else if (entry.Count > 0) { processOtherValues = true; } else { IsDefined = false; } if (processOtherValues) { visitor.ProcessValues(parentIndex, entry.PossibleValues, true); } } else { IsDefined = false; } }