import jalview.util.Format;
import java.io.IOException;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
{
int i = 0;
boolean flag = false;
- boolean rna = false;
boolean top = false;
- StringBuffer pssecstr = new StringBuffer(),
- consstr = new StringBuffer();
- Vector headers = new Vector();
- Hashtable seqhash = new Hashtable();
+ StringBuffer pssecstr = new StringBuffer();
+ StringBuffer consstr = new StringBuffer();
+ Vector<String> headers = new Vector<>();
+ Map<String, StringBuffer> seqhash = new HashMap<>();
StringBuffer tempseq;
String line, id;
StringTokenizer str;
{
top = true;
}
- if (line.indexOf(" ") != 0)
+ boolean isConservation = line.startsWith(SPACE)
+ || line.startsWith(TAB);
+ if (!isConservation)
{
- str = new StringTokenizer(line, " ");
+ str = new StringTokenizer(line);
if (str.hasMoreTokens())
{
{
if (seqhash.containsKey(id))
{
- tempseq = (StringBuffer) seqhash.get(id);
+ tempseq = seqhash.get(id);
}
else
{
AlignmentAnnotation lastssa = null;
if (pssecstr.length() == maxLength)
{
- Vector ss = new Vector();
+ Vector<AlignmentAnnotation> ss = new Vector<>();
AlignmentAnnotation ssa = lastssa = StockholmFile
.parseAnnotationRow(ss, "secondary structure",
pssecstr.toString());
}
if (consstr.length() == maxLength)
{
- Vector ss = new Vector();
+ Vector<AlignmentAnnotation> ss = new Vector<>();
AlignmentAnnotation ssa = StockholmFile.parseAnnotationRow(ss,
"secondary structure", consstr.toString());
ssa.label = "Consensus Secondary Structure";
{
String tmp = printId(s[i], jvsuffix);
- if (s[i].getSequence().length > max)
- {
- max = s[i].getSequence().length;
- }
+ max = Math.max(max, s[i].getLength());
if (tmp.length() > maxid)
{
out.append(new Format("%-" + maxid + "s")
.form(printId(s[j], jvsuffix) + " "));
- int start = i * len;
- int end = start + len;
+ int chunkStart = i * len;
+ int chunkEnd = chunkStart + len;
- if ((end < s[j].getSequence().length)
- && (start < s[j].getSequence().length))
+ int length = s[j].getLength();
+ if ((chunkEnd < length) && (chunkStart < length))
{
- out.append(s[j].getSequenceAsString(start, end));
+ out.append(s[j].getSequenceAsString(chunkStart, chunkEnd));
}
else
{
- if (start < s[j].getSequence().length)
+ if (chunkStart < length)
{
- out.append(s[j].getSequenceAsString().substring(start));
+ out.append(s[j].getSequenceAsString().substring(chunkStart));
}
}