[Biococoa-dev] Annotation

Koen van der Drift kvddrift at earthlink.net
Fri Feb 18 20:37:01 EST 2005


Hi,

This weekend I might be trying to implement the code for annotations. 
Unless someone else feels the urge to do so ;-) I noticed that Charles 
has added the following instance variable to BCAbstractSequence.h:

NSMutableArray	*annotationArray;    //coming soon!!


Not sure what you had in mind here, Charles. Would this be an array of 
BCAnnotation objects? In that case each BCAnnotation object would be 
take care of just one annotation. However, I suggest we use a 
NSDictionary instead. The next decision would be if we add a 
NSMutableDictionary variable to the sequence, or create a separate 
BCAnnotations class that manages the annotations (basically a wrapper). 
In the latter case, to add a annotation, we could use the following 
code


[mySequence addAnnotation: @"value" forKey: @"key"];


This will then call in BCAbstractSequence

- (id) addAnnotation:(NSString *)aValue forKey:(NSString *) aKey
{
	[[self annotations] addAnnotation: aValue forKey: aKey];
}


And then in BCAnnotations:

- (id) addAnnotation:(NSString *)aValue forKey:(NSString *) aKey
{
	[[self annotationDictionary] setObject: aValue forKey: aKey];
}

etc.

It seems redundant to add almost two similar calls, my thought here is 
is that if we keep the interaction with the dictionary in a wrapper, it 
becomes easier to change things, and add more possibilities (searching, 
eg).



What do you think of this approach?


cheers,

- Koen.





More information about the Biococoa-dev mailing list