}
public void setType(PDBEntry.Type type)
{
- this.type = type.toString();
+ this.type = type == null ? null : type.toString();
}
public String getType()
*/
package jalview.io;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
import jalview.util.MessageManager;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
/**
* DOCUMENT ME!
*
for (int i = 0; i < seqs.size(); i++)
{
- s[i] = (SequenceI) seqs.elementAt(i);
+ s[i] = seqs.elementAt(i);
}
return s;
* Rna.GetBasePairsFromAlignmentAnnotation(annotations.elementAt(i));
* Rna.HelixMap(pairArray);
*/
- AlignmentAnnotation an = (AlignmentAnnotation) annotations
+ AlignmentAnnotation an = annotations
.elementAt(i);
an.validateRangeAndDisplay();
al.addAnnotation(an);
*/
protected void initData()
{
- seqs = new Vector();
- annotations = new Vector();
+ seqs = new Vector<SequenceI>();
+ annotations = new Vector<AlignmentAnnotation>();
seqGroups = new ArrayList<SequenceGroup>();
parseCalled=false;
}
*/
protected void setSeqs(SequenceI[] s)
{
- seqs = new Vector();
+ seqs = new Vector<SequenceI>();
for (int i = 0; i < s.length; i++)
{
/**
* vector of String[] treeName, newickString pairs
*/
- Vector newickStrings = null;
+ Vector<String[]> newickStrings = null;
protected void addNewickTree(String treeName, String newickString)
{
if (newickStrings == null)
{
- newickStrings = new Vector();
+ newickStrings = new Vector<String[]>();
}
newickStrings.addElement(new String[]
{ treeName, newickString });
protected int getTreeCount()
{
- if (newickStrings == null)
- {
- return 0;
- }
- return newickStrings.size();
+ return newickStrings == null ? 0 : newickStrings.size();
}
}
* Expand the subsequence to the full sequence abcDEFghi
*/
AlignmentI expanded = AlignmentUtils.expandContext(al, -1);
- // FIXME expandContext adds an unnecessary gap; need tests to cover all
- // cases for which 'maxOffset' is computed
- assertEquals("-abcDEFghi", expanded.getSequenceAt(0)
+ assertEquals("abcDEFghi", expanded.getSequenceAt(0)
.getSequenceAsString());
/*
assertNull(ann.annotations[0]);
assertNull(ann.annotations[1]);
assertNull(ann.annotations[2]);
- assertNull(ann.annotations[3]);
- assertEquals(4, ann.annotations[4].value, 0.001);
- assertEquals(5, ann.annotations[5].value, 0.001);
- assertEquals(6, ann.annotations[6].value, 0.001);
+ assertEquals(4, ann.annotations[3].value, 0.001);
+ assertEquals(5, ann.annotations[4].value, 0.001);
+ assertEquals(6, ann.annotations[5].value, 0.001);
+ assertNull(ann.annotations[6]);
assertNull(ann.annotations[7]);
assertNull(ann.annotations[8]);
- assertNull(ann.annotations[9]);
/*
* sequence position mappings should be unchanged
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.PDBEntry;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
-import java.io.File;
-import java.util.Vector;
-
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
public class AnnotatedPDBFileInputTest
{
AlignFrame af = loader.LoadFileWaitTillLoaded(pdbStr,
FormatAdapter.FILE);
al = af.getViewport().getAlignment();
- pdbId = ((PDBEntry) al.getSequenceAt(0).getDatasetSequence().getPDBId()
- .get(0)).getId();
+ pdbId = al.getSequenceAt(0).getDatasetSequence().getPDBId()
+ .get(0).getId();
}
@Test
}
assertNotNull(sq.getPDBId());
assertEquals("Expected only one PDB ID", sq.getPDBId().size(), 1);
- for (PDBEntry pdbentry : (Vector<PDBEntry>) sq.getPDBId())
+ for (PDBEntry pdbentry : sq.getPDBId())
{
System.err.println("PDB Entry " + pdbentry.getId() + " "
+ pdbentry.getFile());