X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;fp=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=e1c87a921394049e99a09388412fcf52a7aa84fd;hb=0eda79421bb03c19e3b74c4b83b1644ca12ea66c;hp=0aa8424dafb4070c61dcd0bcab487f4c86c59209;hpb=4441bd429663862f7746542dc94c2834884f31e3;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 0aa8424..e1c87a9 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -26,7 +26,6 @@ import java.util.BitSet; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; -import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; @@ -2034,52 +2033,35 @@ public class Alignment implements AlignmentI, AutoCloseable } } - Map contactmaps = new HashMap<>(); + //// + //// Contact Matrix Holder Boilerplate + //// + ContactMapHolder cmholder = new ContactMapHolder(); @Override public Collection getContactMaps() { - if (contactmaps != null && contactmaps.size() > 0) - { - return contactmaps.values(); - } - return Collections.EMPTY_LIST; + return cmholder.getContactMaps(); } @Override public ContactListI getContactListFor(AlignmentAnnotation _aa, int column) { - ContactMatrixI cm = contactmaps.get(_aa.annotationId); - if (cm == null) - { - return null; - } - return cm.getContactList(column); + return cmholder.getContactListFor(_aa, column); } @Override public AlignmentAnnotation addContactList(ContactMatrixI cm) { + AlignmentAnnotation aa = cmholder.addContactList(cm); + Annotation _aa[] = new Annotation[getWidth()]; Annotation dummy = new Annotation(0.0f); for (int i = 0; i < _aa.length; _aa[i++] = dummy) { ; } - AlignmentAnnotation aa = new AlignmentAnnotation("Contact Matrix", - "Contact Matrix", _aa); - aa.graph = AlignmentAnnotation.CUSTOMRENDERER; - aa.graphMin = cm.getMin(); - aa.graphMax = cm.getMax(); - aa.editable = false; - // aa.autoCalculated = true; - contactmaps.put(aa.annotationId, cm); - // TODO: contact matrices could be intra or inter - more than one refseq - // possible! - if (cm.hasReferenceSeq()) - { - aa.setSequenceRef(cm.getReferenceSeq()); - } + aa.annotations = _aa; addAnnotation(aa); return aa; }