1 | package de.ugoe.cs.autoquest.plugin.alignment.substitution; |
---|
2 | |
---|
3 | import java.util.ArrayList; |
---|
4 | import java.util.Collection; |
---|
5 | import java.util.Iterator; |
---|
6 | |
---|
7 | import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel; |
---|
8 | import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; |
---|
9 | |
---|
10 | import java.util.List; |
---|
11 | |
---|
12 | import misc.AlignmentHelpers; |
---|
13 | import de.ugoe.cs.autoquest.eventcore.Event; |
---|
14 | import de.ugoe.cs.util.console.GlobalDataContainer; |
---|
15 | |
---|
16 | public class ObjectDistanceSubstitionMatrix implements SubstitutionMatrix { |
---|
17 | |
---|
18 | private ArrayList<int[][]> matrix; |
---|
19 | private int currentSequence; |
---|
20 | |
---|
21 | |
---|
22 | public ObjectDistanceSubstitionMatrix() { |
---|
23 | currentSequence = 0; |
---|
24 | matrix = new ArrayList<int[][]>(); |
---|
25 | } |
---|
26 | |
---|
27 | @Override |
---|
28 | public String info() { |
---|
29 | // TODO Auto-generated method stub |
---|
30 | return null; |
---|
31 | } |
---|
32 | |
---|
33 | @Override |
---|
34 | public double getDistance(int pos1, int pos2) { |
---|
35 | // TODO Auto-generated method stub |
---|
36 | |
---|
37 | return matrix.get(currentSequence)[pos1][pos2]; |
---|
38 | } |
---|
39 | |
---|
40 | public double getDistance(int sequence, int pos1, int pos2) { |
---|
41 | return matrix.get(sequence)[pos1][pos2]; |
---|
42 | |
---|
43 | |
---|
44 | } |
---|
45 | |
---|
46 | @Override |
---|
47 | public double getGapPenalty() { |
---|
48 | // TODO Auto-generated method stub |
---|
49 | return 0; |
---|
50 | } |
---|
51 | |
---|
52 | @Override |
---|
53 | public void generate(Collection<List<Event>> eventList) { |
---|
54 | |
---|
55 | for(Iterator<List<Event>> seqs = eventList.iterator(); seqs.hasNext();) { |
---|
56 | matrix.add(new int[eventList.size()][eventList.size()]); |
---|
57 | List<Event> tmpList = seqs.next(); |
---|
58 | |
---|
59 | for (int i=0; i < tmpList.size(); i++) { |
---|
60 | for (int j=0; j < tmpList.size(); j++) { |
---|
61 | IGUIElement first = (IGUIElement) tmpList.get(i).getTarget(); |
---|
62 | IGUIElement second =(IGUIElement) tmpList.get(j).getTarget(); |
---|
63 | matrix.get(currentSequence)[i][j] = AlignmentHelpers.distanceBetween(first, second); |
---|
64 | } |
---|
65 | } |
---|
66 | } |
---|
67 | } |
---|
68 | } |
---|