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