private void SearchChildrenForMatches(ImportObject start, string sfm, ref ArrayList possibleObjects) { // small performance enhancement by getting rid of the foreach and using a for loop int count = start.ChildrenCount; // .ChildrenList.Count; for (int i = 0; i < count; i++) { ImportObject child = start.ChildAt(i); // ChildrenList[i]; if (child.Closed == false && (child.CanAddSFM(sfm, m_converter) || child.CanAddSFMasAutoField(sfm, m_converter))) { possibleObjects.Add(child); // save it as a possible resting place for this sfm and data } SearchChildrenForMatches(child, sfm, ref possibleObjects); } }
// Any class that has children (Entry, Sense, Subentry), when that class is // created/started any open classes at the current level that are also // children of the new class will be closed. // // Deterministic - Describes an algorithm in which the correct next step // depends only on the current state protected void RemoveChildrenForNewImportObject(ImportObject parent, string importClassName, Hashtable childrenTable, ImportObject objNotToRemove) { // Get a list of children names of the new 'importClassName' and then // close any of the children nodes of the 'parent' if they are the same. if (childrenTable.ContainsKey(importClassName)) { ArrayList childNames = childrenTable[importClassName] as ArrayList; // small performance enhancement by getting rid of the foreach and using a for loop int count = parent.ChildrenCount; // .ChildrenList.Count; for (int i = 0; i<count; i++) { ImportObject child = parent.ChildAt(i); if (child == objNotToRemove) continue; if (!child.Closed && childNames.Contains(child.Name)) // found child node that should be closed { CloseImportObject(child); // don't be 'open' for anymore markers } } } // parent.AddChild(importClassName); }