X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FDBRefEntry.java;h=0581845a090b85af1b8538a4cff0404349c6669d;hb=9ad1e437d5d6366f0b06fbfbdb446a720ca57104;hp=887a7511068b36d9ccc6f96d7eef95b9ec19963a;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index 887a751..0581845 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -1,20 +1,22 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.datamodel; @@ -40,14 +42,14 @@ public class DBRefEntry /** * * @param source - * canonical source (uppercase only) + * canonical source (uppercase only) * @param version - * (source dependent version string) + * (source dependent version string) * @param accessionId - * (source dependent accession number string) + * (source dependent accession number string) * @param map - * (mapping from local sequence numbering to source accession - * numbering) + * (mapping from local sequence numbering to source accession + * numbering) */ public DBRefEntry(String source, String version, String accessionId, Mapping map) @@ -67,12 +69,20 @@ public class DBRefEntry (entry.map == null ? null : new Mapping(entry.map))); } - public boolean equals(DBRefEntry entry) + @Override + public boolean equals(Object o) { + // TODO should also override hashCode to ensure equal objects have equal + // hashcodes + if (o == null || !(o instanceof DBRefEntry)) + { + return false; + } + DBRefEntry entry = (DBRefEntry) o; if (entry == this) + { return true; - if (entry == null) - return false; + } if (equalRef(entry) && ((map == null && entry.map == null) || (map != null && entry.map != null && map.equals(entry.map)))) @@ -95,7 +105,9 @@ public class DBRefEntry return false; } if (entry == this) + { return true; + } if ((source != null && entry.source != null && source .equalsIgnoreCase(entry.source)) && (accessionId != null && entry.accessionId != null && accessionId @@ -125,7 +137,7 @@ public class DBRefEntry /** * @param accessionId - * the accessionId to set + * the accessionId to set */ public void setAccessionId(String accessionId) { @@ -134,7 +146,7 @@ public class DBRefEntry /** * @param source - * the source to set + * the source to set */ public void setSource(String source) { @@ -143,7 +155,7 @@ public class DBRefEntry /** * @param version - * the version to set + * the version to set */ public void setVersion(String version) { @@ -160,7 +172,7 @@ public class DBRefEntry /** * @param map - * the map to set + * the map to set */ public void setMap(Mapping map) { @@ -181,4 +193,9 @@ public class DBRefEntry return ((source != null) ? source : "") + ":" + ((accessionId != null) ? accessionId : ""); } + + public String toString() + { + return getSrcAccString(); + } }