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
28 * @author Andreas Prlic
30 public class DasCoordinateSystem {
40 public DasCoordinateSystem () {
50 public boolean equals(DasCoordinateSystem other){
52 System.out.println("comparing " + this.toString() + " to " + other.toString());
54 if ( (! uniqueId.equals("")) && ( uniqueId.equals( other.getUniqueId())))
57 if ( ncbi_tax_id != other.getNCBITaxId()) {
58 System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != " + other.getNCBITaxId());
61 if ( ! version.equals(other.getVersion() )){
62 System.out.println("mismatch in version");
65 if ( ! category.equals(other.getCategory()) ) {
66 System.out.println("mismatch in category");
69 if ( ! name.equals(other.getName())) {
70 System.out.println("mismatch in name");
73 System.out.println(" match: " + match);
78 public Object clone() {
79 DasCoordinateSystem d = new DasCoordinateSystem();
80 d.setTestCode(testCode);
81 d.setCategory(category);
83 d.setNCBITaxId(ncbi_tax_id);
84 d.setUniqueId(getUniqueId());
85 d.setOrganismName(getOrganismName());
86 d.setVersion(getVersion());
90 public String getTestCode() {
96 public void setTestCode(String testCode) {
97 if ( testCode == null)
99 this.testCode = testCode;
104 public void setUniqueId(String id) { uniqueId = id ; }
105 public String getUniqueId() { return uniqueId; }
107 public void setName(String n) { name = n; }
108 public String getName() { return name; }
110 public void setCategory(String c) { category = c;}
111 public String getCategory() { return category;}
113 public void setOrganismName(String t) { organism_name =t;}
114 public String getOrganismName() { return organism_name;}
116 public void setNCBITaxId(int id) { ncbi_tax_id = id;}
117 public int getNCBITaxId(){ return ncbi_tax_id ;}
122 public String getVersion() {
126 public void setVersion(String version) {
127 if ( version == null)
129 this.version = version;
132 public String toString() {
134 if ( ! version.equals(""))
135 nam += "_" + version;
137 if ( organism_name.equals("") )
138 return nam+","+category ;
140 return nam+","+category+"," + organism_name ;
143 public static DasCoordinateSystem fromString(String rawString) {
144 String[] spl = rawString.split(",");
145 DasCoordinateSystem dcs = new DasCoordinateSystem();
146 if ( spl.length == 2 ) {
148 dcs.setCategory(spl[1]);
150 if ( spl.length == 3 ) {
152 dcs.setCategory(spl[1]);
153 dcs.setOrganismName(spl[2]);