+ (id) groupWithTag: (NSString *) aTag
{
- id newGroup;
-
- newGroup = [self new];
- [newGroup autorelease];
- [newGroup setTag: aTag];
-
- return newGroup;
+ return [self elementWithTag: aTag];
}
+ (id) groupWithTag: (NSString *) aTag
{
id newGroup;
- newGroup = [self new];
- [newGroup autorelease];
- [newGroup setTag: aTag];
+ newGroup = [self elementWithTag: aTag];
[newGroup addChildren: someChildren];
return newGroup;
[self addChild: aChild];
}
+- (CardElement *) firstChildWithTag: (NSString *) aTag;
+{
+ Class mappedClass;
+ CardElement *child, *mappedChild;
+ NSArray *existing;
+
+ existing = [self childrenWithTag: aTag];
+ if ([existing count])
+ {
+ child = [existing objectAtIndex: 0];
+ mappedClass = [self classForTag: [aTag uppercaseString]];
+ if (mappedClass)
+ {
+ if ([child isKindOfClass: [CardGroup class]])
+ mappedChild = [(CardGroup *) child groupWithClass: mappedClass];
+ else
+ mappedChild = [child elementWithClass: mappedClass];
+ }
+ else
+ mappedChild = child;
+ }
+ else
+ mappedChild = nil;
+
+ return mappedChild;
+}
+
- (void) addChildren: (NSArray *) someChildren
{
CardElement *currentChild;