[Biococoa-dev] KDTextView update
Alexander Griekspoor
a.griekspoor at nki.nl
Thu Apr 13 20:00:17 EDT 2006
> I don't think a textview should take of filtering, it should just
> display a string. The controller should take care of the filtering,
> which would be more an MVC approach.
>> A solution in the context of what you had in mind would be to
>> delegate the filtering to the controller in those methods that I
>> override, which is easy to do and elegant.
>
> That's indeed a more MVC approach, so I will look into that.
That's the difference between providing something for extensive reuse
and something that fulfils specific needs in my app ;-)
Usually, the latter evolves slowly to the first, with the pressure on
slowly, that's why it's done that way yet, at least the "proper" idea
is there ;-)
>
> BTW, I think you forgot to include the Color_Extension and
> String_Extension files. The latter I guess contains the
> filterDNABases method?
The color you can replace to your liking, here's the relevant string
method:
-(NSString *)filterDNABases
{
int i;
NSMutableString* filteredstring = [NSMutableString
stringWithCapacity: [self length]];
NSString *upper = [self uppercaseString];
for(i=0; i<[upper length]; i++){
switch([upper characterAtIndex: i]){
case 'A':
[filteredstring appendString: @"A"];
break;
case 'C':
[filteredstring appendString: @"C"];
break;
case 'G':
[filteredstring appendString: @"G"];
break;
case 'T':
[filteredstring appendString: @"T"];
break;
case 'U':
[filteredstring appendString: @"T"];
break;
case 'W':
[filteredstring appendString: @"N"];
break;
case 'S':
[filteredstring appendString: @"N"];
break;
case 'M':
[filteredstring appendString: @"N"];
break;
case 'K':
[filteredstring appendString: @"N"];
break;
case 'R':
[filteredstring appendString: @"N"];
break;
case 'Y':
[filteredstring appendString: @"N"];
break;
case 'H':
[filteredstring appendString: @"N"];
break;
case 'V':
[filteredstring appendString: @"N"];
break;
case 'D':
[filteredstring appendString: @"N"];
break;
case 'B':
[filteredstring appendString: @"N"];
break;
case 'N':
[filteredstring appendString: @"N"];
break;
default:
break;
}
}
return filteredstring;
}
Alex
>
> cheers,
>
> - Koen
>
> _______________________________________________
> Biococoa-dev mailing list
> Biococoa-dev at bioinformatics.org
> https://bioinformatics.org/mailman/listinfo/biococoa-dev
>
***********************************
Mek (Alexander Griekspoor)
MekenTosj.com
Web: http://www.mekentosj.com
Mail: mek at mekentosj.com
***********************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.bioinformatics.org/pipermail/biococoa-dev/attachments/20060414/6e675495/attachment.html>
More information about the Biococoa-dev
mailing list