[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] Names for particles



Daniel Russel wrote:
- It is probably worthwhile to have a name for each particle which uniquely identifies the particle.

Can't we just use a regular string attribute for this? I don't much like the idea of adding another set of get/set methods purely for this purpose. And in many cases, we don't really care what the particles are called. Thus, I don't like the idea of wasting the memory needed to store all those strings, and having to make sure all the particles have unique dummy names (and presumably having to do a hash lookup for every new particle). Output methods can use the 'name' string attribute if there is one in any case. For reading in particles where you do care about not duplicating names, surely it's straightforward to provide a method to look up a particle by a given string attribute, so that you can decide on a case by case basis what to do about duplicated names (e.g. rename, combine the two particles in some way, throw an exception, or use only the new or existing particle). Why not just have a Model method to add an index for a given StringKey? This would create and then maintain a hash to allow rapid lookup of particles by values of that StringKey. I imagine this would be useful for things other than a simple 'name'.

	Ben
--
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle