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