private static uint GetHashCode(NucleotidRna _1, NucleotidRna _2, NucleotidRna _3) { var a = (uint) _1; var b = (uint) _2; var c = (uint) _3; return (a + 1) | ((b + 1) << 8) | ((c + 1) << 16); }
public static AminoAcid Translate(NucleotidRna _1, NucleotidRna _2, NucleotidRna _3) { var code = GetHashCode(_1, _2, _3); AminoAcid res; if (!_translationTable.TryGetValue(code, out res)) { throw new ArgumentOutOfRangeException(); } return res; }
static void Add(NucleotidRna _1, NucleotidRna _2, NucleotidRna _3, AminoAcid acid) { var code = GetHashCode(_1, _2, _3); _translationTable.Add(code, acid); }
public static char ToChar(NucleotidRna nucleotid) { switch (nucleotid) { case NucleotidRna.A: return 'A'; case NucleotidRna.G: return 'G'; case NucleotidRna.C: return 'C'; case NucleotidRna.U: return 'U'; default: throw new ArgumentOutOfRangeException("nucleotid"); } }