source: trunk/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/substitution/NearbySubstitutionMatrix.java @ 1324

Last change on this file since 1324 was 1324, checked in by rkrimmel, 10 years ago
File size: 1.0 KB
Line 
1/**
2 *
3 */
4package de.ugoe.cs.autoquest.plugin.alignment.substitution;
5
6import java.util.Collection;
7import java.util.List;
8
9import de.ugoe.cs.autoquest.eventcore.Event;
10
11/**
12 * @author Ralph Krimmel
13 *
14 */
15public 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
51        @Override
52        public void generate(Collection<List<Event>> eventList) {
53                // TODO Auto-generated method stub
54               
55        }
56
57}
Note: See TracBrowser for help on using the repository browser.