Line | |
---|
1 | /** |
---|
2 | * |
---|
3 | */ |
---|
4 | package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; |
---|
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 | */ |
---|
25 | public double getScore(int pos1, int pos2) { |
---|
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 |
---|
37 | public double getGapPenalty() { |
---|
38 | return -range-1; |
---|
39 | } |
---|
40 | |
---|
41 | |
---|
42 | @Override |
---|
43 | public void generate() { |
---|
44 | // TODO Auto-generated method stub |
---|
45 | |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.