updated jalview version of dasobert 1.53e client and added Das Sequence Source discov...
[jalview.git] / src / org / biojava / dasobert / dasregistry / DasCoordinateSystem.java
index 31caaf5..48508d9 100755 (executable)
  */
 package org.biojava.dasobert.dasregistry;
 
-
-/** a Bean to be returned via SOAP. It takes care of the DAS -  coordinate Systems 
+/** a Bean to be returned via SOAP. It takes care of the DAS -  coordinate Systems
  * @author Andreas Prlic
  */
-public class DasCoordinateSystem {
-
-    String name;
-    String category;
-    String organism_name;
-    int ncbi_tax_id ;
-    String uniqueId ;
-    String version;
-    String testCode;
-    
-    public DasCoordinateSystem () {
-        uniqueId = "";
-        name = "";
-        category ="";
-        organism_name = "";
-        ncbi_tax_id = 0;
-        version = "";
-        testCode = "";
+public class DasCoordinateSystem
+{
+
+  String name;
+  String category;
+  String organism_name;
+  int ncbi_tax_id;
+  String uniqueId;
+  String version;
+  String testCode;
+
+  public DasCoordinateSystem()
+  {
+    uniqueId = "";
+    name = "";
+    category = "";
+    organism_name = "";
+    ncbi_tax_id = 0;
+    version = "";
+    testCode = "";
+  }
+
+  public boolean equals(DasCoordinateSystem other)
+  {
+    boolean match = true;
+    System.out.println("comparing " + this.toString() + " to " + other.toString());
+    // URI has piority
+    if ( (!uniqueId.equals("")) && (uniqueId.equals(other.getUniqueId())))
+    {
+      return true;
     }
 
-    public boolean equals(DasCoordinateSystem other){
-        boolean match = true;
-        System.out.println("comparing " + this.toString() + " to " + other.toString());
-        // URI has piority 
-        if ( (! uniqueId.equals("")) && ( uniqueId.equals( other.getUniqueId())))
-            return true;
-        
-        if ( ncbi_tax_id != other.getNCBITaxId()) {
-            System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != " + other.getNCBITaxId());
-            match = false;
-        }
-        if ( ! version.equals(other.getVersion() )){
-            System.out.println("mismatch in version");
-            match = false;
-        }
-        if ( ! category.equals(other.getCategory())  ) {
-            System.out.println("mismatch in category");
-            match = false;
-        }
-        if ( ! name.equals(other.getName())) {
-            System.out.println("mismatch in name");   
-            match = false;
-        }
-        System.out.println(" match: " + match);
-        
-        return match;
+    if (ncbi_tax_id != other.getNCBITaxId())
+    {
+      System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != " +
+                         other.getNCBITaxId());
+      match = false;
     }
-    
-    public Object clone() {
-        DasCoordinateSystem d = new DasCoordinateSystem();
-        d.setTestCode(testCode);
-        d.setCategory(category);
-        d.setName(name);
-        d.setNCBITaxId(ncbi_tax_id);
-        d.setUniqueId(getUniqueId());
-        d.setOrganismName(getOrganismName());
-        d.setVersion(getVersion());
-        return d;
+    if (!version.equals(other.getVersion()))
+    {
+      System.out.println("mismatch in version");
+      match = false;
     }
-    
-    public String getTestCode() {
-        return testCode;
+    if (!category.equals(other.getCategory()))
+    {
+      System.out.println("mismatch in category");
+      match = false;
     }
-
-
-
-    public void setTestCode(String testCode) {
-        if ( testCode == null)
-            testCode = "";
-        this.testCode = testCode;
+    if (!name.equals(other.getName()))
+    {
+      System.out.println("mismatch in name");
+      match = false;
     }
+    System.out.println(" match: " + match);
 
-
-
-    public void setUniqueId(String id) { uniqueId = id ;   }
-    public String getUniqueId() { return uniqueId;         }
-
-    public void setName(String n) { name = n; }
-    public String getName() { return name; }
-    
-    public void setCategory(String c) { category = c;}
-    public String getCategory() { return category;}
-
-    public void setOrganismName(String t) { organism_name  =t;} 
-    public String getOrganismName() { return organism_name;}
-
-    public void setNCBITaxId(int id) { ncbi_tax_id = id;}
-    public int getNCBITaxId(){ return ncbi_tax_id ;}
-    
-    
-    
-
-    public String getVersion() {
-        return version;
+    return match;
+  }
+  
+    public int hashCode() {
+        int h = 7;
+        
+        h = 31 * h + ( null == name ? 0 : name.hashCode());
+        h = 31 * h + ( null == category ? 0 : category.hashCode());
+        
+        return h;
     }
 
-    public void setVersion(String version) {
-        if ( version == null)
-            version = "";
-        this.version = version;
+  public Object clone()
+  {
+    DasCoordinateSystem d = new DasCoordinateSystem();
+    d.setTestCode(testCode);
+    d.setCategory(category);
+    d.setName(name);
+    d.setNCBITaxId(ncbi_tax_id);
+    d.setUniqueId(getUniqueId());
+    d.setOrganismName(getOrganismName());
+    d.setVersion(getVersion());
+    return d;
+  }
+
+  public String getTestCode()
+  {
+    return testCode;
+  }
+
+  public void setTestCode(String testCode)
+  {
+    if (testCode == null)
+    {
+      testCode = "";
     }
-
-    public String toString() {
-        String nam = name;
-        if ( ! version.equals(""))
-            nam += "_" + version;
-        
-       if ( organism_name.equals("") ) 
-           return nam+","+category ;
-       else 
-           return nam+","+category+"," + organism_name ;
+    this.testCode = testCode;
+  }
+
+  public void setUniqueId(String id)
+  {
+    uniqueId = id;
+  }
+
+  public String getUniqueId()
+  {
+    return uniqueId;
+  }
+
+  public void setName(String n)
+  {
+    name = n;
+  }
+
+  public String getName()
+  {
+    return name;
+  }
+
+  public void setCategory(String c)
+  {
+    category = c;
+  }
+
+  public String getCategory()
+  {
+    return category;
+  }
+
+  public void setOrganismName(String t)
+  {
+    organism_name = t;
+  }
+
+  public String getOrganismName()
+  {
+    return organism_name;
+  }
+
+  public void setNCBITaxId(int id)
+  {
+    ncbi_tax_id = id;
+  }
+
+  public int getNCBITaxId()
+  {
+    return ncbi_tax_id;
+  }
+
+  public String getVersion()
+  {
+    return version;
+  }
+
+  public void setVersion(String version)
+  {
+    if (version == null)
+    {
+      version = "";
     }
-
-    public static DasCoordinateSystem fromString(String rawString) {
-       String[] spl = rawString.split(",");
-       DasCoordinateSystem dcs = new DasCoordinateSystem();
-       if ( spl.length == 2 ) {
-           dcs.setName(spl[0]);           
-           dcs.setCategory(spl[1]);
-       } 
-       if ( spl.length == 3 ) {
-           dcs.setName(spl[0]);
-           dcs.setCategory(spl[1]);
-           dcs.setOrganismName(spl[2]);
-       }
-       return dcs;
+    this.version = version;
+  }
+
+  public String toString()
+  {
+    String nam = name;
+    if (!version.equals(""))
+    {
+      nam += "_" + version;
     }
 
+    if (organism_name.equals(""))
+    {
+      return nam + "," + category;
+    }
+    else
+    {
+      return nam + "," + category + "," + organism_name;
+    }
+  }
+
+  public static DasCoordinateSystem fromString(String rawString)
+  {
+    String[] spl = rawString.split(",");
+    DasCoordinateSystem dcs = new DasCoordinateSystem();
+    if (spl.length == 2)
+    {
+      dcs.setName(spl[0]);
+      dcs.setCategory(spl[1]);
+    }
+    if (spl.length == 3)
+    {
+      dcs.setName(spl[0]);
+      dcs.setCategory(spl[1]);
+      dcs.setOrganismName(spl[2]);
+    }
+    return dcs;
+  }
 
 }