source: branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java @ 1734

Last change on this file since 1734 was 1734, checked in by rkrimmel, 10 years ago

Added automatically created javadoc, still needs to be commented properly though

File size: 1.7 KB
Line 
1/**
2 *
3 */
4package de.ugoe.cs.autoquest.tasktrees.alignment.matrix;
5
6import java.util.HashSet;
7import java.util.LinkedList;
8
9import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
10
11// TODO: Auto-generated Javadoc
12/**
13 * The Class NearbySubstitutionMatrix.
14 *
15 * @author Ralph Krimmel
16 */
17public class NearbySubstitutionMatrix implements SubstitutionMatrix {
18
19        /** The input1. */
20        private final int[] input1;
21       
22        /** The input2. */
23        private final int[] input2;
24       
25        /** The range. */
26        private final int range;
27
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         */
35        public NearbySubstitutionMatrix(int[] input1, int[] input2, int range) {
36                this.input1 = input1;
37                this.input2 = input2;
38                this.range = range;
39        }
40
41        /* (non-Javadoc)
42         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet)
43         */
44        @Override
45        public void generate(HashSet<ITask> uniqueTasks) {
46        }
47
48        /* (non-Javadoc)
49         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty()
50         */
51        @Override
52        public float getGapPenalty() {
53                return -range - 1;
54        }
55
56        /*
57         * (non-Javadoc)
58         *
59         * @see
60         * de.ugoe.cs.autoquest.plugin.alignment.SubstitutionMatrix#getDistance(int,
61         * int)
62         */
63        @Override
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                }
71        }
72
73        /* (non-Javadoc)
74         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList)
75         */
76        @Override
77        public void update(LinkedList<ITask> newlyGeneratedTasks) {
78        }
79
80}
Note: See TracBrowser for help on using the repository browser.