Lines Matching refs:children
70 * as there are no fields other than the children list, which cannot
71 * be copied as the children are not considered part of this node.
82 children = nil;
92 // children = [[AMutableArray arrayWithCapacity:5] retain];
93 // [children addObject:node];
105 if ( children ) {
107 NSLog( @"called dealloc children in BaseTree" );
109 [children release];
116 if ( children == nil || i >= [children count] ) {
119 return (id<BaseTree>)[children objectAtIndex:i];
122 /** Get the children internal List; note that if you directly mess with
125 - (AMutableArray *) children
127 return children;
132 if ( children != anArray ) {
133 if ( children ) [children release];
136 children = anArray;
141 for (NSUInteger i = 0; children != nil && i < [children count]; i++) {
142 id<BaseTree> t = (id<BaseTree>) [children objectAtIndex:i];
152 if ( children == nil ) {
155 return [children count];
160 * Warning: if t has no children, but child does
161 * and child isNil then this routine moves children to t via
162 * t.children = child.children; i.e., without copying the array.
167 //System.out.println("existing children: "+children);
174 if ( [childTree isNil] ) { // t is an empty node possibly with children
175 if ( children != nil && children == childTree.children ) {
178 // just add all of childTree's children to this
179 if ( childTree.children != nil ) {
180 if ( children != nil ) { // must copy, this has children already
181 int n = [childTree.children count];
183 id<BaseTree> c = (id<BaseTree>)[childTree.children objectAtIndex:i];
184 [children addObject:c];
187 [c setChildIndex:[children count]-1];
191 // no children for this but t has children; just set pointer
193 children = childTree.children;
198 else { // child is not nil (don't care about children)
199 if ( children == nil ) {
200 … children = [[AMutableArray arrayWithCapacity:5] retain]; // create children list on demand
202 [children addObject:t];
204 [childTree setChildIndex:[children count]-1];
206 // System.out.println("now children are: "+children);
209 /** Add all elements of kids list as children of this node */
226 if ( children == nil ) {
227 children = [[AMutableArray arrayWithCapacity:5] retain];
229 if ([children count] > i ) {
230 [children replaceObjectAtIndex:i withObject:t];
233 [children insertObject:t atIndex:i];
241 if ( children == nil ) {
244 id<BaseTree> killed = (id<BaseTree>)[children objectAtIndex:idx];
245 [children removeObjectAtIndex:idx];
251 /** Delete children from start to stop and replace with t even if t is
252 * a list (nil-root Tree). num of children can increase or decrease.
253 * For huge child lists, inserting children can force walking rest of
254 * children to set their childindex; could be slow.
263 if ( children == nil ) {
264 …@throw [IllegalArgumentException newException:@"BaseTree Invalid Indexes; no children in list"]; …
270 // normalize to a list of children to add: newChildren
272 newChildren = newTree.children;
283 int j = 0; // index into new children
286 [children replaceObjectAtIndex:i withObject:(id)child];
293 // set children and then delete extra
295 … [children replaceObjectAtIndex:startChildIndex+j withObject:[newChildren objectAtIndex:j]];
300 [children removeObjectAtIndex:indexToDelete];
305 // fill in as many children as we can (replacingHowMany) w/o moving data
307 … [children replaceObjectAtIndex:startChildIndex+j withObject:[newChildren objectAtIndex:j]];
311 [children insertObject:[newChildren objectAtIndex:j] atIndex:startChildIndex+j];
318 /** Override in a subclass to change the impl of children list */
366 * and its children?
378 * and its children?
477 // the children themselves are not copied here!
481 [theCopy addChildren:self.children];
494 if ( [theCopy.children count] )
495 [theCopy.children removeAllObjects];
496 AMutableArray *childrenCopy = theCopy.children;
497 for (id loopItem in children) {
507 if ( children == nil || [children count] == 0 ) {
510 NSMutableString *buf = [NSMutableString stringWithCapacity:[children count]];
516 for (int i = 0; children != nil && i < [children count]; i++) {
517 id<BaseTree> t = (id<BaseTree>)[children objectAtIndex:i];
546 @synthesize children;