[Biojava-l] FundamentalAtomicSymbol Not Transferable?

Schreiber, Mark mark.schreiber at agresearch.co.nz
Tue Jun 3 10:27:49 EDT 2003


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.
=======================================================================



More information about the Biojava-l mailing list