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;
}
}
- Map<Object, ContactMatrixI> contactmaps = new HashMap<>();
+ ////
+ //// Contact Matrix Holder Boilerplate
+ ////
+ ContactMapHolder cmholder = new ContactMapHolder();
@Override
public Collection<ContactMatrixI> 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;
}