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 Feb 9, 2006
23 package jalview.biojava.dasobert.das2;
25 import jalview.biojava.dasobert.dasregistry.Das1Source;
26 import jalview.biojava.dasobert.dasregistry.DasSource;
28 public class Das2SourceImpl
34 Das2Capability[] capabilities;
36 public Das2SourceImpl() {
39 capabilities = new Das2Capability[0];
43 /** compare if two DasSources are identical
46 public boolean equals(DasSource other){
51 if ( ( other == null) || (other.getClass() != this.getClass()))
54 // to compare if two Das2Sources are identical we do the following:
55 // we check the capabilities
57 Das2SourceImpl d2o = (Das2SourceImpl)other;
59 if ( nickname.equals(d2o.getNickname()))
62 Das2Capability[] othercaps = d2o.getDas2Capabilities();
64 if ( ! (capabilities.length == othercaps.length))
67 for ( int x=0;x<capabilities.length;x++){
68 Das2Capability tmpcap = capabilities[x];
69 boolean foundCap = false;
70 for (int y=0; y< othercaps.length;y++){
71 Das2Capability tmpcapo = othercaps[y];
72 if ( tmpcap.equals(tmpcapo))
81 // should we add a check for coordinate systems?
82 // but we already check for the endpoints, that should be enough...
88 public int hashCode(){
91 h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
93 for ( int x=0;x<capabilities.length;x++){
94 Das2Capability cap = capabilities[x];
95 h = 31 * h + cap.hashCode();
102 public boolean hasDas1Capabilities(){
104 // test if any of the capabilities is a das1 capabilitiy
106 for (int i = 0 ; i < capabilities.length; i++) {
107 Das2Capability cap = capabilities[i];
108 if ( cap.isDas1Style())
116 public String[] getCapabilities() {
117 //todo mark as not needed / not appropriate ...
118 return super.getCapabilities();
123 public void setCapabilities(String[] u) {
124 // TODO Auto-generated method stub
125 super.setCapabilities(u);
130 public Das2Capability[] getDas2Capabilities() {
131 // TODO Auto-generated method stub
135 public void setDas2Capabilities(Das2Capability[] capabilities) {
136 // TODO Auto-generated method stub
137 this.capabilities = capabilities;