public void addParent(WordBase newParent) { WordBase[] newIsa = new WordBase[isa.Length + 1]; for (int i=0; i < isa.Length; i++) { if (isa[i] == newParent) { return; } else { newIsa[i] = isa[i]; } } newIsa[isa.Length] = newParent; isa = newIsa; }
public void addParent(WordBase newParent) { WordBase[] newIsa = new WordBase[isa.Length + 1]; for (int i = 0; i < isa.Length; i++) { if (isa[i] == newParent) { return; } else { newIsa[i] = isa[i]; } } newIsa[isa.Length] = newParent; isa = newIsa; }
// Use the given tag to determine which descendents we've visted before. private List <ProseObject> internalGetAllDescendents(UInt64 tag) { List <ProseObject> descendents = new List <ProseObject>(isa.Length); // Step through the descendents for (int currIdx = 0; currIdx < isa.Length; currIdx++) { // If we've visted this word before skip it. if (isa[currIdx].getTag() == tag) { continue; } WordBase word = (WordBase)isa[currIdx]; // Otherwise, mark it as visited and add it to the list descendents word.setTag(tag); descendents.Add(word); // Add all the descendents of this descendent using the same tag to elminiate dups. descendents.AddRange(word.internalGetAllDescendents(tag)); } return(descendents); }