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);
89 DasCoordinateSystem d = new DasCoordinateSystem();
90 d.setTestCode(testCode);
91 d.setCategory(category);
93 d.setNCBITaxId(ncbi_tax_id);
94 d.setUniqueId(getUniqueId());
95 d.setOrganismName(getOrganismName());
96 d.setVersion(getVersion());
100 public String getTestCode()
105 public void setTestCode(String testCode)
107 if (testCode == null)
111 this.testCode = testCode;
114 public void setUniqueId(String id)
119 public String getUniqueId()
124 public void setName(String n)
129 public String getName()
134 public void setCategory(String c)
139 public String getCategory()
144 public void setOrganismName(String t)
149 public String getOrganismName()
151 return organism_name;
154 public void setNCBITaxId(int id)
159 public int getNCBITaxId()
164 public String getVersion()
169 public void setVersion(String version)
175 this.version = version;
178 public String toString()
181 if (!version.equals(""))
183 nam += "_" + version;
186 if (organism_name.equals(""))
188 return nam + "," + category;
192 return nam + "," + category + "," + organism_name;
196 public static DasCoordinateSystem fromString(String rawString)
198 String[] spl = rawString.split(",");
199 DasCoordinateSystem dcs = new DasCoordinateSystem();
203 dcs.setCategory(spl[1]);
208 dcs.setCategory(spl[1]);
209 dcs.setOrganismName(spl[2]);