JAL-653 GFF new/refactored helper classes
[jalview.git] / src / jalview / datamodel / MappingType.java
diff --git a/src/jalview/datamodel/MappingType.java b/src/jalview/datamodel/MappingType.java
new file mode 100644 (file)
index 0000000..c0c69aa
--- /dev/null
@@ -0,0 +1,63 @@
+package jalview.datamodel;
+
+/**
+ * An enumeration of the kinds of mapping (from nucleotide or peptide, to
+ * nucleotide or peptide), and the corresponding word lengths
+ */
+public enum MappingType
+{
+  NucleotideToPeptide(3, 1)
+  {
+    @Override
+    public MappingType getInverse()
+    {
+      return PeptideToNucleotide;
+    }
+  },
+  PeptideToNucleotide(1, 3)
+  {
+    @Override
+    public MappingType getInverse()
+    {
+      return NucleotideToPeptide;
+    }
+  },
+  NucleotideToNucleotide(1, 1)
+  {
+    @Override
+    public MappingType getInverse()
+    {
+      return NucleotideToNucleotide;
+    }
+  },
+  PeptideToPeptide(1, 1)
+  {
+    @Override
+    public MappingType getInverse()
+    {
+      return PeptideToPeptide;
+    }
+  };
+
+  private int fromRatio;
+
+  private int toRatio;
+
+  private MappingType(int fromSize, int toSize)
+  {
+    fromRatio = fromSize;
+    toRatio = toSize;
+  }
+
+  public abstract MappingType getInverse();
+
+  public int getFromRatio()
+  {
+    return fromRatio;
+  }
+
+  public int getToRatio()
+  {
+    return toRatio;
+  }
+}