From: Jim Procter Date: Thu, 12 Feb 2015 16:47:49 +0000 (+0000) Subject: JAL-1115 switch to lists in SequenceGroup X-Git-Tag: Jalview_2_9~93 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e60b090d3d61aa82d96e5d9946a94e7e4ede8dcb;p=jalview.git JAL-1115 switch to lists in SequenceGroup --- diff --git a/src/jalview/analysis/Grouping.java b/src/jalview/analysis/Grouping.java index e4c9cea..7b6dda1 100644 --- a/src/jalview/analysis/Grouping.java +++ b/src/jalview/analysis/Grouping.java @@ -20,11 +20,14 @@ */ 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; /** @@ -50,9 +53,9 @@ public class Grouping String[] selectedChars, List list) { // TODO: determine how to get/recover input data for group generation - Hashtable gps = new Hashtable(); + Map> gps = new HashMap>(); int width = 0, i; - Hashtable pgroup = new Hashtable(); + Map pgroup = new HashMap(); if (list != null) { for (SequenceGroup sg : list) @@ -66,32 +69,29 @@ public class Grouping 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 svec = gps.get(schar); if (svec == null) { - svec = new Vector(); + svec = new ArrayList(); 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;