JAL-2110 refactor + tests to allow a dbref version to update "0" or
[jalview.git] / src / jalview / api / DBRefEntryI.java
1 package jalview.api;
2
3 import jalview.datamodel.DBRefEntry;
4 import jalview.datamodel.Mapping;
5
6 //JBPComment: this is a datamodel API - so it should be in datamodel (it's a peer of SequenceI)
7
8 public interface DBRefEntryI
9 {
10   public boolean equalRef(DBRefEntryI entry);
11
12   /**
13    * 
14    * @return Source DB name for this entry
15    */
16   public String getSource();
17
18   /**
19    * 
20    * @return Accession Id for this entry
21    */
22   public String getAccessionId();
23
24   /**
25    * 
26    * @param accessionId
27    *          Accession Id for this entry
28    */
29   public void setAccessionId(String accessionId);
30
31   /**
32    * 
33    * @param source
34    *          Source DB name for this entry
35    */
36   public void setSource(String source);
37
38   /**
39    * 
40    * @return Source DB version for this entry
41    */
42   public String getVersion();
43
44   /**
45    * 
46    * @param version
47    *          Source DB version for this entry
48    */
49   public void setVersion(String version);
50
51   /**
52    * 
53    * @param startRes
54    *          index of start residue in the source DB
55    */
56   public void setStartRes(int startRes);
57
58   /**
59    * 
60    * @return index of start residue in the source DB
61    */
62   public int getStartRes();
63
64   /**
65    * 
66    * @param endRes
67    *          index of end residue in the source DB
68    */
69   public void setEndRes(int endRes);
70
71   /**
72    * 
73    * @return index of end residue in the source DB
74    */
75   public int getEndRes();
76
77   public Mapping getMap();
78
79   /**
80    * Answers true if this object is either equivalent to, or can be 'improved'
81    * by, the given entry. Specifically, answers true if
82    * <ul>
83    * <li>source and accession are identical</li>
84    * <li>version is identical, or this version is of the format "someSource:0",
85    * in which case the version for the other entry replaces it</li>
86    * <li>mappings are not compared but if this entry has no mapping, replace
87    * with that for the other entry</li>
88    * </ul>
89    * 
90    * @param otherEntry
91    * @return
92    */
93   public boolean updateFrom(DBRefEntry otherEntry);
94 }