JAL-2110 refactor + tests to allow a dbref version to update "0" or
[jalview.git] / src / jalview / api / DBRefEntryI.java
index 490b21a..49858cb 100644 (file)
@@ -1,5 +1,6 @@
 package jalview.api;
 
+import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.Mapping;
 
 //JBPComment: this is a datamodel API - so it should be in datamodel (it's a peer of SequenceI)
@@ -74,4 +75,20 @@ public interface DBRefEntryI
   public int getEndRes();
 
   public Mapping getMap();
+
+  /**
+   * Answers true if this object is either equivalent to, or can be 'improved'
+   * by, the given entry. Specifically, answers true if
+   * <ul>
+   * <li>source and accession are identical</li>
+   * <li>version is identical, or this version is of the format "someSource:0",
+   * in which case the version for the other entry replaces it</li>
+   * <li>mappings are not compared but if this entry has no mapping, replace
+   * with that for the other entry</li>
+   * </ul>
+   * 
+   * @param otherEntry
+   * @return
+   */
+  public boolean updateFrom(DBRefEntry otherEntry);
 }