[Biojava-l] FundamentalAtomicSymbol Not Transferable?

hz5 at njit.edu hz5 at njit.edu
Tue Jun 3 13:03:09 EDT 2003


Thanks, Mark! Hehe, I wish I could be brave enough to modify equal method and 
use of writeReplace and readResolve, being lazy, I got around the problem with 
a sloppy method. I transferred the symbol name as a string, and I match the 
string back to the simplealphabet and construct the motif using the symbol 
matched in the alphabet. This is kind of sloppy, but as long as my symbol names 
are unique, I think I am fine. Thanks again for your advice!

Is there any way that i can add a symbol to a SimpleSymbolList(mySSL) at a 
specific position, API only provide addSymbol() to the end of the list? Now 
what I can think of is copy the list after the position, increase the list by 
one position, use edit to replace the position with the intended symbol, then 
copy the rest back to the list. It is painful, any suggestions?

for(;;){ thanks(); }

haibo
//cheers


Quoting "Schreiber, Mark" <mark.schreiber at agresearch.co.nz>:

> Hi -
> 
> I suspect what is happening is that your drag and drop operation is
> copying the Symbol. In biojava Symbols are flyweight objects and there
> is only one instance of each Symbol in the alphabet. SymbolLists are
> pointers to the Symbols. Validation is performed using the ==
> operation
> which only returns true if the two pointers point to the same memory
> space and the same object.
> 
> This problem came up with serialization. Fortunately it could be
> solved
> using writeReplace and readResolve() methods. I don't know much about
> the draggable interface but hopefully you can override the default
> behaivour.
> 
> - Mark
> 
> 
> > -----Original Message-----
> > From: hz5 at njit.edu [mailto:hz5 at njit.edu] 
> > Sent: Tuesday, 3 June 2003 8:57 a.m.
> > To: biojava-l at biojava.org
> > Subject: [Biojava-l] FundamentalAtomicSymbol Not Transferable?
> > 
> > 
> > Hi all,
> > It seems that using a HashSet to create a symbollist can only 
> > validate the very 
> > symbols in the HashSet, if I create a new Symbol using the 
> > same name and 
> > annotation, the symbollist cannot validate it because the it 
> > is a new object 
> > than the one in the HashSet.
> > 
> > I encountered this problem in the following situation:
> > I make a DragableJLabel draggable, and upon drop, it transfer a 
> > FundamentalAtomicSymbol(extend it to implement transferrable) to a 
> > DropableJPanel. Before transfer, I can show that the 
> > FundamentalAtomicSymbol 
> > belongs to a 
> > simpleAlphabet(simpleAlphabet.contains(myFundamentalAtomicSymbol) 
> > returns true), but after transfer, the contains method of the same 
> > simpleAlphabet returns false. This make it impossible for 
> > drag and drop to 
> > using symbols to build symbolLists.
> > 
> > Any ideas how to solve this?
> > while(true){
> >   thanks a million;
> > }
> > 
> > //cheers
> > I am using jdk1.4 biojava1.3 
> > =========================================================
> > Haibo Zhang, PhD student
> > Computational Biology, NJIT & Rutgers University
> > Center for Applied Genomics, PHRI
> > http://afs13.njit.edu/~hz5 
> > _______________________________________________
> > Biojava-l mailing list  -  Biojava-l at biojava.org 
> > http://biojava.org/mailman/listinfo/biojava-l
> > 
> =======================================================================
> Attention: The information contained in this message and/or
> attachments
> from AgResearch Limited is intended only for the persons or entities
> to which it is addressed and may contain confidential and/or
> privileged
> material. Any review, retransmission, dissemination or other use of,
> or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipients is prohibited by
> AgResearch
> Limited. If you have received this message in error, please notify the
> sender immediately.
> =======================================================================
> 



=========================================================
Haibo Zhang, PhD student
Computational Biology, NJIT & Rutgers University
Center for Applied Genomics, PHRI
http://afs13.njit.edu/~hz5


More information about the Biojava-l mailing list