X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2Fdas%2FDasSequenceSourceListener.java;h=0b0a065ba3016e9ceece9c194c8f2189deaac27f;hb=a45774ee31d9f35d4eff46d54d7deab719afb092;hp=fa961f03c8798ef66c374cfd18a4b72dfa54cd6f;hpb=54e003f9b2fff47dbfea6401c3944afdb7bd37b3;p=jalview.git
diff --git a/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java b/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java
index fa961f0..0b0a065 100644
--- a/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java
+++ b/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java
@@ -1,3 +1,20 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ */
package jalview.ws.dbsources.das;
import jalview.datamodel.AlignmentI;
@@ -11,25 +28,32 @@ import org.biojava.dasobert.eventmodel.SequenceEvent;
import org.biojava.dasobert.eventmodel.SequenceListener;
/**
- * Listen for sequence fetch events from a dasobert SequenceThread started with a
- * query string and collect sequences returned from the DAS sequence source.
+ * Listen for sequence fetch events from a dasobert SequenceThread started with
+ * a query string and collect sequences returned from the DAS sequence source.
+ *
* @author JimP
- *
+ *
*/
public class DasSequenceSourceListener implements SequenceListener
{
-
+
String ourAccession = null;
- DasSequenceSource oursource=null;
+
+ DasSequenceSource oursource = null;
+
/**
*
- * @param source the DAS Sequence DbProxy object containing database details for this source
- * @param query the query string sent to the das source that we should be listening for.
+ * @param source
+ * the DAS Sequence DbProxy object containing database details for
+ * this source
+ * @param query
+ * the query string sent to the das source that we should be
+ * listening for.
*/
public DasSequenceSourceListener(DasSequenceSource source, String query)
{
- oursource=source;
- ourAccession=query;
+ oursource = source;
+ ourAccession = query;
}
public void clearSelection()
@@ -37,32 +61,38 @@ public class DasSequenceSourceListener implements SequenceListener
// TODO Auto-generated method stub
}
+
java.util.Vector seqs = null;
+
public void newSequence(SequenceEvent e)
{
if (!e.getAccessionCode().equals(ourAccession))
{
- System.err.println("Warning - received sequence event for strange accession code ("
- +e.getAccessionCode()+") - we expected "+ourAccession);
-
+ System.err
+ .println("Warning - received sequence event for strange accession code ("
+ + e.getAccessionCode()
+ + ") - we expected "
+ + ourAccession);
+
return;
}
- if (seqs==null)
+ if (seqs == null)
{
- if (e.getSequence().length()==0)
+ if (e.getSequence().length() == 0)
{
System.err.println("Empty sequence returned for accession code ("
- +e.getAccessionCode()+") from "+oursource.getDbName());
- called=true;
- noSequences=true;
+ + e.getAccessionCode() + ") from " + oursource.getDbName());
+ called = true;
+ noSequences = true;
return;
}
seqs = new java.util.Vector();
}
Sequence sq = new Sequence(e.getAccessionCode(), e.getSequence());
- sq.addDBRef(new DBRefEntry(oursource.getDbSource(), oursource.getDbVersion()+":"+e.getVersion(), e.getAccessionCode()));
+ sq.addDBRef(new DBRefEntry(oursource.getDbSource(), oursource
+ .getDbVersion() + ":" + e.getVersion(), e.getAccessionCode()));
seqs.addElement(sq);
- called=true;
+ called = true;
}
public void selectedSeqPosition(int position)
@@ -88,19 +118,25 @@ public class DasSequenceSourceListener implements SequenceListener
// TODO Auto-generated method stub
}
- boolean noSequences=false;
+
+ boolean noSequences = false;
+
public void noObjectFound(String accessionCode)
{
if (accessionCode.equals(ourAccession))
{
- noSequences=true;
+ noSequences = true;
called = true;
}
}
- public boolean hasNoSequences() {
+
+ public boolean hasNoSequences()
+ {
return noSequences;
}
- boolean called=false;
+
+ boolean called = false;
+
public boolean isNotCalled()
{
return !called;
@@ -108,10 +144,10 @@ public class DasSequenceSourceListener implements SequenceListener
public AlignmentI getSequences()
{
- if (noSequences || seqs!=null && seqs.size()==0)
+ if (noSequences || seqs != null && seqs.size() == 0)
return null;
SequenceI[] sqs = new SequenceI[seqs.size()];
- for (int i=0,iSize=seqs.size(); i