Rev | Line | |
---|
[1314] | 1 | /** |
---|
| 2 | * |
---|
| 3 | */ |
---|
[1572] | 4 | package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; |
---|
[1314] | 5 | |
---|
[1698] | 6 | import java.util.HashSet; |
---|
| 7 | import java.util.LinkedList; |
---|
| 8 | |
---|
| 9 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
| 10 | |
---|
[1314] | 11 | /** |
---|
| 12 | * @author Ralph Krimmel |
---|
| 13 | * |
---|
| 14 | */ |
---|
| 15 | public class NearbySubstitutionMatrix implements SubstitutionMatrix { |
---|
| 16 | |
---|
[1733] | 17 | private final int[] input1; |
---|
| 18 | private final int[] input2; |
---|
| 19 | private final int range; |
---|
| 20 | |
---|
| 21 | public NearbySubstitutionMatrix(int[] input1, int[] input2, int range) { |
---|
[1314] | 22 | this.input1 = input1; |
---|
| 23 | this.input2 = input2; |
---|
| 24 | this.range = range; |
---|
| 25 | } |
---|
[1733] | 26 | |
---|
| 27 | @Override |
---|
| 28 | public void generate(HashSet<ITask> uniqueTasks) { |
---|
[1314] | 29 | } |
---|
| 30 | |
---|
| 31 | @Override |
---|
[1702] | 32 | public float getGapPenalty() { |
---|
[1733] | 33 | return -range - 1; |
---|
[1314] | 34 | } |
---|
| 35 | |
---|
[1733] | 36 | /* |
---|
| 37 | * (non-Javadoc) |
---|
| 38 | * |
---|
| 39 | * @see |
---|
| 40 | * de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, |
---|
| 41 | * int) |
---|
| 42 | */ |
---|
[1324] | 43 | @Override |
---|
[1733] | 44 | public float getScore(int pos1, int pos2) { |
---|
| 45 | final int difference = Math.abs(input1[pos1] - input2[pos2]); |
---|
| 46 | if (difference < range) { |
---|
| 47 | return range - difference; |
---|
| 48 | } else { |
---|
| 49 | return -range; |
---|
| 50 | } |
---|
[1324] | 51 | } |
---|
| 52 | |
---|
[1698] | 53 | @Override |
---|
| 54 | public void update(LinkedList<ITask> newlyGeneratedTasks) { |
---|
| 55 | } |
---|
| 56 | |
---|
[1314] | 57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.