X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=5282000915d1533cc1e46d57e4a89966e5accf07;hb=e309b8d9bd62fb304fdd612c7385e76027d2f2d7;hp=09d9ee01246ace4b6e6b69d55f784bc86678027a;hpb=ad15cff29620f960119f80176f1fd443da9f6763;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 09d9ee0..5282000 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -27,9 +27,8 @@ import jalview.analysis.WUSSParseException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Enumeration; import java.util.HashMap; -import java.util.Hashtable; +import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; @@ -155,7 +154,7 @@ public class AlignmentAnnotation /** * map of positions in the associated annotation */ - public java.util.Hashtable sequenceMapping; + private Map sequenceMapping; /** DOCUMENT ME!! */ public float graphMin; @@ -499,6 +498,7 @@ public class AlignmentAnnotation : annotations[index + offset].secondaryStructure); } + @Override public String toString() { char[] string = new char[max - offset]; @@ -710,12 +710,13 @@ public class AlignmentAnnotation if (annotation.sequenceMapping != null) { Integer p = null; - sequenceMapping = new Hashtable(); - Enumeration pos = annotation.sequenceMapping.keys(); - while (pos.hasMoreElements()) + sequenceMapping = new HashMap(); + Iterator pos = annotation.sequenceMapping.keySet() + .iterator(); + while (pos.hasNext()) { // could optimise this! - p = (Integer) pos.nextElement(); + p = pos.next(); Annotation a = annotation.sequenceMapping.get(p); if (a == null) { @@ -789,11 +790,11 @@ public class AlignmentAnnotation int epos = sequenceRef.findPosition(endRes); if (sequenceMapping != null) { - Hashtable newmapping = new Hashtable(); - Enumeration e = sequenceMapping.keys(); - while (e.hasMoreElements()) + Map newmapping = new HashMap(); + Iterator e = sequenceMapping.keySet().iterator(); + while (e.hasNext()) { - Integer pos = (Integer) e.nextElement(); + Integer pos = e.next(); if (pos.intValue() >= spos && pos.intValue() <= epos) { newmapping.put(pos, sequenceMapping.get(pos)); @@ -836,9 +837,10 @@ public class AlignmentAnnotation * * @return DOCUMENT ME! */ + @Override public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(256); for (int i = 0; i < annotations.length; i++) { @@ -911,7 +913,7 @@ public class AlignmentAnnotation { return; } - sequenceMapping = new java.util.Hashtable(); + sequenceMapping = new HashMap(); int seqPos; @@ -1223,7 +1225,7 @@ public class AlignmentAnnotation .getTo() == sq.getDatasetSequence()) : false; // TODO build a better annotation element map and get rid of annotations[] - Hashtable mapForsq = new Hashtable(); + Map mapForsq = new HashMap(); if (sequenceMapping != null) { if (sp2sq != null) @@ -1275,7 +1277,8 @@ public class AlignmentAnnotation { if (mapping != null) { - Hashtable old = sequenceMapping, remap = new Hashtable(); + Map old = sequenceMapping; + Map remap = new HashMap(); int index = -1; for (int mp[] : mapping) {