+package jalview.datamodel;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A singleton object that holds all mappings between sequences
+ *
+ * @author gmcarstairs
+ *
+ */
+public class SequenceMappings
+{
+ private static SequenceMappings instance;
+
+ private Map<SequenceI, List<SequenceMapping>> mappingsFrom;
+
+ private Map<SequenceI, List<SequenceMapping>> mappingsTo;
+
+ /**
+ * Non-instantiable class
+ */
+ private SequenceMappings()
+ {
+ mappingsFrom = new HashMap<>();
+ mappingsTo = new HashMap<>();
+ }
+
+ /**
+ * Answers the singleton instance of this class
+ *
+ * @return
+ */
+ public SequenceMappings getInstance()
+ {
+ return instance;
+ }
+
+ /**
+ * Answers a (possibly empty) unmodifiable list of mappings from the given
+ * sequence
+ *
+ * @param seq
+ * @return
+ */
+ public List<SequenceMapping> getMappingsFromSequence(SequenceI seq)
+ {
+ List<SequenceMapping> from = mappingsFrom.get(seq);
+ return from == null ? Collections.emptyList()
+ : Collections.unmodifiableList(from);
+ }
+
+ /**
+ * Answers a (possibly empty) unmodifiable list of mappings to the given
+ * sequence
+ *
+ * @param seq
+ * @return
+ */
+ public List<SequenceMapping> getMappingsToSequence(SequenceI seq)
+ {
+ List<SequenceMapping> from = mappingsTo.get(seq);
+ return from == null ? Collections.emptyList()
+ : Collections.unmodifiableList(from);
+ }
+
+ /**
+ * Answers a (possibly empty) list of mappings from the given sequence to its
+ * complement(s), defined as mappings that are either CdsToPeptide or
+ * PeptideToCds
+ *
+ * @param seq
+ * @return
+ */
+ public List<SequenceMapping> getMappingsToComplement(SequenceI seq)
+ {
+ List<SequenceMapping> from = mappingsTo.get(seq);
+ List<SequenceMapping> result = new ArrayList<>();
+ for (SequenceMapping mapping : from)
+ {
+ MappingType type = mapping.getType();
+ }
+ return result;
+ }
+}