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 org.biojava.dasobert.das2;
25 import org.biojava.dasobert.dasregistry.*;
27 public class Das2SourceImpl extends Das1Source implements Das2Source
31 Das2Capability[] capabilities;
33 public Das2SourceImpl()
37 capabilities = new Das2Capability[0];
41 * compare if two DasSources are identical
44 public boolean equals(DasSource other)
52 if ((other == null) || (other.getClass() != this.getClass()))
57 // to compare if two Das2Sources are identical we do the following:
58 // we check the capabilities
60 Das2SourceImpl d2o = (Das2SourceImpl) other;
62 if (nickname.equals(d2o.getNickname()))
67 Das2Capability[] othercaps = d2o.getDas2Capabilities();
69 if (!(capabilities.length == othercaps.length))
74 for (int x = 0; x < capabilities.length; x++)
76 Das2Capability tmpcap = capabilities[x];
77 boolean foundCap = false;
78 for (int y = 0; y < othercaps.length; y++)
80 Das2Capability tmpcapo = othercaps[y];
81 if (tmpcap.equals(tmpcapo))
93 // should we add a check for coordinate systems?
94 // but we already check for the endpoints, that should be enough...
100 public int hashCode()
104 h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
106 for (int x = 0; x < capabilities.length; x++)
108 Das2Capability cap = capabilities[x];
109 h = 31 * h + cap.hashCode();
115 public boolean hasDas1Capabilities()
118 // test if any of the capabilities is a das1 capabilitiy
120 for (int i = 0; i < capabilities.length; i++)
122 Das2Capability cap = capabilities[i];
123 if (cap.isDas1Style())
132 public String[] getCapabilities()
134 // todo mark as not needed / not appropriate ...
135 return super.getCapabilities();
138 public void setCapabilities(String[] u)
140 // TODO Auto-generated method stub
141 super.setCapabilities(u);
144 public Das2Capability[] getDas2Capabilities()
146 // TODO Auto-generated method stub
150 public void setDas2Capabilities(Das2Capability[] capabilities)
152 // TODO Auto-generated method stub
153 this.capabilities = capabilities;