2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.datamodel;
21 public class DBRefEntry
23 String source = "", version = "", accessionId = "";
26 * maps from associated sequence to the database sequence's coordinate system
35 public DBRefEntry(String source, String version, String accessionId)
37 this(source, version, accessionId, null);
43 * canonical source (uppercase only)
45 * (source dependent version string)
47 * (source dependent accession number string)
49 * (mapping from local sequence numbering to source accession
52 public DBRefEntry(String source, String version, String accessionId,
55 this.source = source.toUpperCase();
56 this.version = version;
57 this.accessionId = accessionId;
61 public DBRefEntry(DBRefEntry entry)
64 (entry.source == null ? "" : new String(entry.source)),
65 (entry.version == null ? "" : new String(entry.version)),
66 (entry.accessionId == null ? "" : new String(entry.accessionId)),
67 (entry.map == null ? null : new Mapping(entry.map)));
70 public boolean equals(DBRefEntry entry)
77 && ((map == null && entry.map == null) || (map != null
78 && entry.map != null && map.equals(entry.map))))
86 * test for similar DBRef attributes, except for the map object.
89 * @return true if source, accession and version are equal with those of entry
91 public boolean equalRef(DBRefEntry entry)
99 if ((source != null && entry.source != null && source
100 .equalsIgnoreCase(entry.source))
101 && (accessionId != null && entry.accessionId != null && accessionId
102 .equalsIgnoreCase(entry.accessionId))
103 && (version != null && entry.version != null && version
104 .equalsIgnoreCase(entry.version)))
111 public String getSource()
116 public String getVersion()
121 public String getAccessionId()
128 * the accessionId to set
130 public void setAccessionId(String accessionId)
132 this.accessionId = accessionId;
139 public void setSource(String source)
141 this.source = source;
148 public void setVersion(String version)
150 this.version = version;
156 public Mapping getMap()
165 public void setMap(Mapping map)
170 public boolean hasMap()
177 * @return source+":"+accessionId
179 public String getSrcAccString()
181 return ((source != null) ? source : "") + ":"
182 + ((accessionId != null) ? accessionId : "");