*/
package jalview.analysis;
+import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import java.util.Hashtable;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Vector;
/**
String[] selectedChars, List<SequenceGroup> list)
{
// TODO: determine how to get/recover input data for group generation
- Hashtable gps = new Hashtable();
+ Map<String, List<SequenceI>> gps = new HashMap<String, List<SequenceI>>();
int width = 0, i;
- Hashtable pgroup = new Hashtable();
+ Map<String, SequenceGroup> pgroup = new HashMap<String, SequenceGroup>();
if (list != null)
{
for (SequenceGroup sg : list)
for (i = 0; i < sequences.length; i++)
{
String schar = selectedChars[i];
- SequenceGroup pgp = (SequenceGroup) pgroup
- .get(((Object) sequences[i]).toString());
+ SequenceGroup pgp = pgroup.get(((Object) sequences[i]).toString());
if (pgp != null)
{
schar = pgp.getName() + ":" + schar;
}
- Vector svec = (Vector) gps.get(schar);
+ List<SequenceI> svec = gps.get(schar);
if (svec == null)
{
- svec = new Vector();
+ svec = new ArrayList<SequenceI>();
gps.put(schar, svec);
}
if (width < sequences[i].getLength())
{
width = sequences[i].getLength();
}
- svec.addElement(sequences[i]);
+ svec.add(sequences[i]);
}
// make some groups
- java.util.Enumeration sge = gps.keys();
SequenceGroup[] groups = new SequenceGroup[gps.size()];
i = 0;
- while (sge.hasMoreElements())
+ for (String key : gps.keySet())
{
- String key = (String) sge.nextElement();
- SequenceGroup group = new SequenceGroup((Vector) gps.get(key),
+ SequenceGroup group = new SequenceGroup(gps.get(key),
"Subseq: " + key, null, true, true, false, 0, width - 1);
groups[i++] = group;