@Override protected void init(AlignMatrix<Double> matrix) { matrix.set(0.0); for (int row = 1; row < matrix.getRows(); row++) { matrix.set(-1.0 * gapOpen * row, row, Position.FIRST); } for (int column = 1; column < matrix.getColumns(); column++) { matrix.set(-1.0 * gapOpen * column, Position.FIRST, column); } }
@Override protected double score( AlignMatrix<Double> matrix, int row, int column, CharSequence a, CharSequence b, int direction) { double score = matrix.get(row, column); if (direction == DIRECTION_DIAGONAL) { score += this.match(a.charAt(row), b.charAt(column)); } else { score -= gapOpen; } return score; }