Rev | Line | |
---|
[1314] | 1 | /** |
---|
| 2 | * |
---|
| 3 | */ |
---|
[1572] | 4 | package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; |
---|
[1314] | 5 | |
---|
[1324] | 6 | |
---|
[1314] | 7 | /** |
---|
| 8 | * @author Ralph Krimmel |
---|
| 9 | * |
---|
| 10 | */ |
---|
| 11 | public class DifferenceSubstitutionMatrix implements SubstitutionMatrix { |
---|
| 12 | |
---|
| 13 | private int[] input1; |
---|
| 14 | private int[] input2; |
---|
| 15 | private int maxValue; |
---|
| 16 | |
---|
| 17 | public DifferenceSubstitutionMatrix(int[] input1,int[] input2) { |
---|
| 18 | this.input1 = input1; |
---|
| 19 | this.input2 = input2; |
---|
| 20 | this.maxValue = getMaxValue(); |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | /* (non-Javadoc) |
---|
| 24 | * @see de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, int) |
---|
| 25 | */ |
---|
[1578] | 26 | public double getScore(int pos1, int pos2) { |
---|
[1314] | 27 | return maxValue - (input1[pos1] - input2[pos2]); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | private int getMaxValue() { |
---|
| 31 | int max = input1[0]; |
---|
| 32 | for (int i=0; i < input1.length; i++) { |
---|
| 33 | if(input1[i] > max) { |
---|
| 34 | max = input1[i]; |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | for (int j=0; j < input2.length; j++) { |
---|
| 38 | if(input2[j] > max) { |
---|
| 39 | max = input2[j]; |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | return max; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | @Override |
---|
[1568] | 46 | public double getGapPenalty() { |
---|
[1314] | 47 | return -maxValue; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | |
---|
[1324] | 51 | @Override |
---|
[1554] | 52 | public void generate() { |
---|
[1324] | 53 | // TODO Auto-generated method stub |
---|
| 54 | |
---|
| 55 | } |
---|
| 56 | |
---|
[1314] | 57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.