[1324] | 1 | package de.ugoe.cs.autoquest.plugin.alignment.substitution; |
---|
| 2 | |
---|
[1331] | 3 | import java.util.ArrayList; |
---|
[1324] | 4 | import java.util.Collection; |
---|
[1331] | 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 | |
---|
[1324] | 10 | import java.util.List; |
---|
| 11 | |
---|
[1331] | 12 | import misc.AlignmentHelpers; |
---|
[1324] | 13 | import de.ugoe.cs.autoquest.eventcore.Event; |
---|
[1331] | 14 | import de.ugoe.cs.util.console.GlobalDataContainer; |
---|
[1324] | 15 | |
---|
| 16 | public class ObjectDistanceSubstitionMatrix implements SubstitutionMatrix { |
---|
| 17 | |
---|
[1331] | 18 | private ArrayList<int[][]> matrix; |
---|
| 19 | private int currentSequence; |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | public ObjectDistanceSubstitionMatrix() { |
---|
| 23 | currentSequence = 0; |
---|
| 24 | matrix = new ArrayList<int[][]>(); |
---|
| 25 | } |
---|
| 26 | |
---|
[1324] | 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 |
---|
[1331] | 36 | |
---|
| 37 | return matrix.get(currentSequence)[pos1][pos2]; |
---|
[1324] | 38 | } |
---|
[1449] | 39 | |
---|
| 40 | public double getDistance(int sequence, int pos1, int pos2) { |
---|
| 41 | return matrix.get(sequence)[pos1][pos2]; |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | } |
---|
[1324] | 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 | |
---|
[1331] | 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 | } |
---|
[1324] | 67 | } |
---|
| 68 | } |
---|