[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 | |
---|
[1734] | 11 | // TODO: Auto-generated Javadoc |
---|
[1314] | 12 | /** |
---|
[1734] | 13 | * The Class NearbySubstitutionMatrix. |
---|
| 14 | * |
---|
[1314] | 15 | * @author Ralph Krimmel |
---|
| 16 | */ |
---|
| 17 | public class NearbySubstitutionMatrix implements SubstitutionMatrix { |
---|
| 18 | |
---|
[1734] | 19 | /** The input1. */ |
---|
[1733] | 20 | private final int[] input1; |
---|
[1734] | 21 | |
---|
| 22 | /** The input2. */ |
---|
[1733] | 23 | private final int[] input2; |
---|
[1734] | 24 | |
---|
| 25 | /** The range. */ |
---|
[1733] | 26 | private final int range; |
---|
| 27 | |
---|
[1734] | 28 | /** |
---|
| 29 | * Instantiates a new nearby substitution matrix. |
---|
| 30 | * |
---|
| 31 | * @param input1 the input1 |
---|
| 32 | * @param input2 the input2 |
---|
| 33 | * @param range the range |
---|
| 34 | */ |
---|
[1733] | 35 | public NearbySubstitutionMatrix(int[] input1, int[] input2, int range) { |
---|
[1314] | 36 | this.input1 = input1; |
---|
| 37 | this.input2 = input2; |
---|
| 38 | this.range = range; |
---|
| 39 | } |
---|
[1733] | 40 | |
---|
[1734] | 41 | /* (non-Javadoc) |
---|
| 42 | * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) |
---|
| 43 | */ |
---|
[1733] | 44 | @Override |
---|
| 45 | public void generate(HashSet<ITask> uniqueTasks) { |
---|
[1314] | 46 | } |
---|
| 47 | |
---|
[1734] | 48 | /* (non-Javadoc) |
---|
| 49 | * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() |
---|
| 50 | */ |
---|
[1314] | 51 | @Override |
---|
[1702] | 52 | public float getGapPenalty() { |
---|
[1733] | 53 | return -range - 1; |
---|
[1314] | 54 | } |
---|
| 55 | |
---|
[1733] | 56 | /* |
---|
| 57 | * (non-Javadoc) |
---|
| 58 | * |
---|
| 59 | * @see |
---|
| 60 | * de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, |
---|
| 61 | * int) |
---|
| 62 | */ |
---|
[1324] | 63 | @Override |
---|
[1733] | 64 | public float getScore(int pos1, int pos2) { |
---|
| 65 | final int difference = Math.abs(input1[pos1] - input2[pos2]); |
---|
| 66 | if (difference < range) { |
---|
| 67 | return range - difference; |
---|
| 68 | } else { |
---|
| 69 | return -range; |
---|
| 70 | } |
---|
[1324] | 71 | } |
---|
| 72 | |
---|
[1734] | 73 | /* (non-Javadoc) |
---|
| 74 | * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) |
---|
| 75 | */ |
---|
[1698] | 76 | @Override |
---|
| 77 | public void update(LinkedList<ITask> newlyGeneratedTasks) { |
---|
| 78 | } |
---|
| 79 | |
---|
[1314] | 80 | } |
---|