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;
26 /** a Bean to be returned via SOAP. It takes care of the DAS - coordinate Systems
27 * @author Andreas Prlic
29 public class DasCoordinateSystem
40 public DasCoordinateSystem()
51 public boolean equals(DasCoordinateSystem other)
54 System.out.println("comparing " + this.toString() + " to " + other.toString());
56 if ( (!uniqueId.equals("")) && (uniqueId.equals(other.getUniqueId())))
61 if (ncbi_tax_id != other.getNCBITaxId())
63 System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != " +
64 other.getNCBITaxId());
67 if (!version.equals(other.getVersion()))
69 System.out.println("mismatch in version");
72 if (!category.equals(other.getCategory()))
74 System.out.println("mismatch in category");
77 if (!name.equals(other.getName()))
79 System.out.println("mismatch in name");
82 System.out.println(" match: " + match);
87 public int hashCode() {
90 h = 31 * h + ( null == name ? 0 : name.hashCode());
91 h = 31 * h + ( null == category ? 0 : category.hashCode());
98 DasCoordinateSystem d = new DasCoordinateSystem();
99 d.setTestCode(testCode);
100 d.setCategory(category);
102 d.setNCBITaxId(ncbi_tax_id);
103 d.setUniqueId(getUniqueId());
104 d.setOrganismName(getOrganismName());
105 d.setVersion(getVersion());
109 public String getTestCode()
114 public void setTestCode(String testCode)
116 if (testCode == null)
120 this.testCode = testCode;
123 public void setUniqueId(String id)
128 public String getUniqueId()
133 public void setName(String n)
138 public String getName()
143 public void setCategory(String c)
148 public String getCategory()
153 public void setOrganismName(String t)
158 public String getOrganismName()
160 return organism_name;
163 public void setNCBITaxId(int id)
168 public int getNCBITaxId()
173 public String getVersion()
178 public void setVersion(String version)
184 this.version = version;
187 public String toString()
190 if (!version.equals(""))
192 nam += "_" + version;
195 if (organism_name.equals(""))
197 return nam + "," + category;
201 return nam + "," + category + "," + organism_name;
205 public static DasCoordinateSystem fromString(String rawString)
207 String[] spl = rawString.split(",");
208 DasCoordinateSystem dcs = new DasCoordinateSystem();
212 dcs.setCategory(spl[1]);
217 dcs.setCategory(spl[1]);
218 dcs.setOrganismName(spl[2]);