[Biojava-l] SimpleSymbolList is now editable

David Waring dwaring@u.washington.edu
Fri, 14 Sep 2001 10:03:35 -0700


A new version of SimpleSymbolList has now been checked in. I have
implemented edit(). There seems to be a consensus that subLists should not
be altered by an edit on the underlying SymbolList, and that is the way I
constructed it. There was one suggestion that we could add an overloaded
method that would have as subList reflect the changes, but I have not done
this. There are still some issues that make that complicated so I figure
that unless people really want it, it can wait.

The subList() method creates a view on the original until there is an edit.
It generates a new SimpleSymbolList (so the subList is editable) but this is
itself just a view onto the original, with a reference to the original
SimpleSymbolList and it's symbols array. It is registered as a
ChangeListener to the original. If an edit to the original would modify the
subList, the subList becomes 'real' meaning it gets its own symbols array
and looses reference to the original. This occurs in the preChange method,
so if the edit was vetoed it remains real. If the edit to the original would
not change the subList, it is not made 'real'. If a subList is edited it is
made 'real' before the edit is implemented but after it is checked for
errors, and firePreChange() has been called, so it will not be made real if
the edit was vetoed.

I have added the constructor SimpleSymbolList (SymbolParser,String). As I
state in the javadoc, I see this mostly as a way to make it easy to make a
SymbolList when someone is trying to figure things out.

Thanks to Thomas, and others for suggestions.

David

|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|   David Waring
|   Systems Programmer
|   University of Washington Genome Center
|   dwaring@u.washington.edu
|   (206) 221-6902
|||||||||||||||||||||||||||||||||||||||||||||||||||||||