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