Line | |
---|
1 | /** |
---|
2 | * |
---|
3 | */ |
---|
4 | package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; |
---|
5 | |
---|
6 | import java.util.HashSet; |
---|
7 | import java.util.LinkedList; |
---|
8 | |
---|
9 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
10 | |
---|
11 | /** |
---|
12 | * @author Ralph Krimmel |
---|
13 | * |
---|
14 | */ |
---|
15 | public class NearbySubstitutionMatrix implements SubstitutionMatrix { |
---|
16 | |
---|
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) { |
---|
22 | this.input1 = input1; |
---|
23 | this.input2 = input2; |
---|
24 | this.range = range; |
---|
25 | } |
---|
26 | |
---|
27 | @Override |
---|
28 | public void generate(HashSet<ITask> uniqueTasks) { |
---|
29 | } |
---|
30 | |
---|
31 | @Override |
---|
32 | public float getGapPenalty() { |
---|
33 | return -range - 1; |
---|
34 | } |
---|
35 | |
---|
36 | /* |
---|
37 | * (non-Javadoc) |
---|
38 | * |
---|
39 | * @see |
---|
40 | * de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int, |
---|
41 | * int) |
---|
42 | */ |
---|
43 | @Override |
---|
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 | } |
---|
51 | } |
---|
52 | |
---|
53 | @Override |
---|
54 | public void update(LinkedList<ITask> newlyGeneratedTasks) { |
---|
55 | } |
---|
56 | |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.