Dont readd identical DBRef
authoramwaterhouse <Andrew Waterhouse>
Mon, 13 Nov 2006 16:12:07 +0000 (16:12 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 13 Nov 2006 16:12:07 +0000 (16:12 +0000)
src/jalview/datamodel/Sequence.java

index e2fc057..cad59c8 100755 (executable)
@@ -621,9 +621,17 @@ public class Sequence implements SequenceI
     if (dbrefs == null)
       dbrefs = new DBRefEntry[0];
 
-    DBRefEntry[] temp = new DBRefEntry[dbrefs.length + 1];
-    System.arraycopy(dbrefs, 0, temp, 0, dbrefs.length);
+    int i, iSize = dbrefs.length;
 
+    for(i=0; i<iSize; i++)
+      if(dbrefs[i].getAccessionId().equals(entry.getAccessionId())
+      && dbrefs[i].getSource().equals(entry.getSource())
+      && dbrefs[i].getVersion().equals(entry.getVersion()))
+      {
+        return;
+      }
+
+    DBRefEntry[] temp = new DBRefEntry[iSize + 1];
     temp[temp.length - 1] = entry;
 
     dbrefs = temp;