Last change
on this file since 1698 was
1698,
checked in by rkrimmel, 10 years ago
|
Speed improvement by just calculating distances between newly created tasks and the old matrix.
|
File size:
1.0 KB
|
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 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 getScore(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 | |
---|
47 | |
---|
48 | @Override |
---|
49 | public void generate(HashSet<ITask> uniqueTasks) { |
---|
50 | } |
---|
51 | |
---|
52 | @Override |
---|
53 | public void update(LinkedList<ITask> newlyGeneratedTasks) { |
---|
54 | } |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.