/// <summary> /// Clear any attached data components (of any type) /// from the objects in this collection /// </summary> /// <param name="ofType"></param> public void ClearAttachedData() { foreach (ModelObject mO in this) { if (mO is DataOwner) { DataOwner dO = (DataOwner)mO; dO.ClearData(); } } }
// TODO: Remove deleted objects to avoid the ghosts of long-gone objects from hanging around /// <summary> /// Remove from the items stored under greater history count numbers the component of /// the specified type /// </summary> /// <param name="componentType"></param> /// <param name="sourceRef"></param> /// <param name="iteration"></param> /// <param name="historyItemCount"></param> /// <remarks>Intended to help tidy up parametric assignments (such as node supports) which /// could persist while the input nodes have changed. Not currently used.</remarks> public void CleanIterationData(Type componentType, string sourceRef, int iteration, int historyItemCount) { if (SourceMap.ContainsKey(sourceRef)) { IList <IList <ModelObject> > iterations = SourceMap[sourceRef]; for (int i = iteration + 1; i < iterations.Count; i++) { IList <ModelObject> uniques = iterations[i]; for (int j = historyItemCount; j < uniques.Count; j++) { ModelObject unique = uniques[j]; if (unique != null && !unique.IsDeleted && unique is DataOwner) { DataOwner dO = (DataOwner)unique; dO.ClearData(componentType); } } } } }