2 * BioJava development code
4 * This code may be freely distributed and modified under the
5 * terms of the GNU Lesser General Public Licence. This should
6 * be distributed with the code. If you do not have a copy,
9 * http://www.gnu.org/copyleft/lesser.html
11 * Copyright for this code is held jointly by the individual
12 * authors. These should be listed in @author doc comments.
14 * For more information on the BioJava project and its aims,
15 * or to join the biojava-l mailing list, visit the home page
18 * http://www.biojava.org/
20 * Created on 15.04.2004
21 * @author Andreas Prlic
24 package org.biojava.dasobert.dasregistry;
27 * a Bean to be returned via SOAP. It takes care of the DAS - coordinate Systems
29 * @author Andreas Prlic
31 public class DasCoordinateSystem
48 public DasCoordinateSystem()
59 public boolean equals(DasCoordinateSystem other)
62 System.out.println("comparing " + this.toString() + " to "
65 if ((!uniqueId.equals("")) && (uniqueId.equals(other.getUniqueId())))
70 if (ncbi_tax_id != other.getNCBITaxId())
72 System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != "
73 + other.getNCBITaxId());
76 if (!version.equals(other.getVersion()))
78 System.out.println("mismatch in version");
81 if (!category.equals(other.getCategory()))
83 System.out.println("mismatch in category");
86 if (!name.equals(other.getName()))
88 System.out.println("mismatch in name");
91 System.out.println(" match: " + match);
100 h = 31 * h + (null == name ? 0 : name.hashCode());
101 h = 31 * h + (null == category ? 0 : category.hashCode());
106 public Object clone()
108 DasCoordinateSystem d = new DasCoordinateSystem();
109 d.setTestCode(testCode);
110 d.setCategory(category);
112 d.setNCBITaxId(ncbi_tax_id);
113 d.setUniqueId(getUniqueId());
114 d.setOrganismName(getOrganismName());
115 d.setVersion(getVersion());
119 public String getTestCode()
124 public void setTestCode(String testCode)
126 if (testCode == null)
130 this.testCode = testCode;
133 public void setUniqueId(String id)
138 public String getUniqueId()
143 public void setName(String n)
148 public String getName()
153 public void setCategory(String c)
158 public String getCategory()
163 public void setOrganismName(String t)
168 public String getOrganismName()
170 return organism_name;
173 public void setNCBITaxId(int id)
178 public int getNCBITaxId()
183 public String getVersion()
188 public void setVersion(String version)
194 this.version = version;
197 public String toString()
200 if (!version.equals(""))
202 nam += "_" + version;
205 if (organism_name.equals(""))
207 return nam + "," + category;
211 return nam + "," + category + "," + organism_name;
215 public static DasCoordinateSystem fromString(String rawString)
217 String[] spl = rawString.split(",");
218 DasCoordinateSystem dcs = new DasCoordinateSystem();
222 dcs.setCategory(spl[1]);
227 dcs.setCategory(spl[1]);
228 dcs.setOrganismName(spl[2]);