@@ -131,35 +131,12 @@ - (id) initWithItemUUID: (ETUUID *)aUUID
131131}
132132
133133- (void ) insertValue : (id )aValue
134- ofType : (COType *)aType
135134 inStoreItem : (COMutableItem *)aStoreItem
136135{
137- if (![aType isPrimitive ])
138- {
139- [NSException raise: NSInvalidArgumentException
140- format: @" expected primitive type" ];
141- }
142-
143- if (nil == [aStoreItem typeForAttribute: attribute])
144- {
145- [aStoreItem setType: [COType arrayWithPrimitiveType: aType]
146- forAttribute: attribute];
147- }
148- else
149- {
150- if (![[aStoreItem typeForAttribute: attribute] isMultivalued ] ||
151- ![[aStoreItem typeForAttribute: attribute] isOrdered ] ||
152- ![[[aStoreItem typeForAttribute: attribute] primitiveType ] isEqual: aType])
153- {
154- [NSException raise: NSInvalidArgumentException
155- format: @" type mismatch" ];
156- }
157- }
158-
159- NSMutableArray *array = [[NSMutableArray alloc ] initWithArray: [aStoreItem valueForAttribute: attribute]];
160- [array insertObject: aValue atIndex: index];
161- [aStoreItem setValue: array forAttribute: attribute];
162- [array release ];
136+ [aStoreItem addObject: aValue
137+ toOrderedAttribute: attribute
138+ atIndex: index
139+ type: type];
163140}
164141
165142- (BOOL ) isEqual : (id )object
@@ -179,14 +156,9 @@ @implementation COItemPathToUnorderedContainer
179156- (void ) insertValue : (id )aValue
180157 inStoreItem : (COMutableItem *)aStoreItem
181158{
182- assert ([[aStoreItem typeForAttribute: attribute] isMultivalued ]);
183- assert (![[aStoreItem typeForAttribute: attribute] isOrdered ]);
184-
185- NSMutableSet *set = [[aStoreItem valueForAttribute: attribute] mutableCopy ]; // may be NSMutableSet subclass NSCountedSet
186- assert ([set isKindOfClass: [NSMutableSet class ]]);
187- [set addObject: aValue];
188- [aStoreItem setValue: set forAttribute: attribute];
189- [set release ];
159+ [aStoreItem addObject: aValue
160+ toUnorderedAttribute: attribute
161+ type: type];
190162}
191163
192164@end
@@ -197,7 +169,9 @@ @implementation COItemPathToValue
197169- (void ) insertValue : (id )aValue
198170 inStoreItem : (COMutableItem *)aStoreItem
199171{
200- // FIXME:
172+ [aStoreItem setValue: aValue
173+ forAttribute: attribute
174+ type: type];
201175}
202176
203177@end
0 commit comments