/// <summary> /// Find the Maximum Score in given list /// </summary> /// <param name="scores">List of scores</param> /// <returns>Maximum score</returns> private static Score GetMaximumScore(Score[] scores) { Score maxScore = scores[DeleteState].Value > scores[InsertState].Value ? scores[DeleteState] : scores[InsertState]; return maxScore.Value > scores[MatchState].Value ? maxScore : scores[MatchState]; }
/// <summary> /// Initializes a new instance of the Node class /// </summary> internal Node() { Scores = new Score[3] { new Score(), new Score(), new Score() }; }
/// <summary> /// Calculate the score of operation /// </summary> /// <param name="currentScore">Current Score</param> /// <param name="deleteScore">Score of delete</param> /// <param name="insertScore">Score of Insert</param> /// <param name="matchScore">Score of match</param> private static void SetScore( Score currentScore, int deleteScore, int insertScore, int matchScore) { if (deleteScore > insertScore) { if (deleteScore > matchScore) { currentScore.Value = deleteScore; currentScore.State = DeleteState; } else { currentScore.Value = matchScore; currentScore.State = MatchState; } } else if (insertScore > matchScore) { currentScore.Value = insertScore; currentScore.State = InsertState; } else { currentScore.Value = matchScore; currentScore.State = MatchState; } }