Changeset 1734 for branches/autoquest-core-tasktrees-alignment/src
- Timestamp:
- 09/05/14 20:20:29 (10 years ago)
- Location:
- branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 94 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Alignment.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 3 6 import java.util.ArrayList; 4 7 8 // TODO: Auto-generated Javadoc 9 /** 10 * The Class Alignment. 11 */ 5 12 public class Alignment { 13 14 /** The alingment. */ 6 15 ArrayList<NumberSequence> alingment; 7 16 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithm.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 … … 5 8 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 6 9 10 // TODO: Auto-generated Javadoc 11 /** 12 * The Interface AlignmentAlgorithm. 13 */ 7 14 public interface AlignmentAlgorithm { 8 15 16 /** 17 * Align. 18 * 19 * @param input1 the input1 20 * @param input2 the input2 21 * @param submat the submat 22 * @param threshold the threshold 23 */ 9 24 void align(NumberSequence input1, NumberSequence input2, 10 25 SubstitutionMatrix submat, float threshold); 11 26 27 /** 28 * Gets the alignment. 29 * 30 * @return the alignment 31 */ 12 32 public abstract ArrayList<NumberSequence> getAlignment(); 13 33 14 34 /** 15 35 * Get the alignment score between the two input strings. 36 * 37 * @return the alignment score 16 38 */ 17 39 public abstract double getAlignmentScore(); 18 40 41 /** 42 * Gets the matches. 43 * 44 * @return the matches 45 */ 19 46 public abstract ArrayList<Match> getMatches(); 20 47 48 /** 49 * Gets the max score. 50 * 51 * @return the max score 52 */ 21 53 public double getMaxScore(); 22 54 55 /** 56 * Prints the alignment. 57 */ 23 58 public abstract void printAlignment(); 24 59 60 /** 61 * Prints the dp matrix. 62 */ 25 63 public abstract void printDPMatrix(); 26 64 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 6 // TODO: Auto-generated Javadoc 7 /** 8 * A factory for creating AlignmentAlgorithm objects. 9 */ 3 10 public class AlignmentAlgorithmFactory { 4 11 12 /** 13 * Creates the. 14 * 15 * @return the alignment algorithm 16 */ 5 17 public static AlignmentAlgorithm create() { 6 18 Class<?> newclass; … … 18 30 } 19 31 32 /** 33 * Sets the default algorithm. 34 * 35 * @param algorithmname the new default algorithm 36 */ 20 37 public static void setDefaultAlgorithm(String algorithmname) { 21 38 // TODO: check for valid algorihm class names here … … 23 40 } 24 41 42 /** The algorithmclass. */ 25 43 private static String algorithmclass = "de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated"; 26 44 } -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentHelpers.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 … … 7 10 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 8 11 12 // TODO: Auto-generated Javadoc 13 /** 14 * The Class AlignmentHelpers. 15 */ 9 16 public class AlignmentHelpers extends GUIModel { 10 17 18 /** 19 * Distance between. 20 * 21 * @param first the first 22 * @param second the second 23 * @return the int 24 */ 11 25 public static int distanceBetween(IGUIElement first, IGUIElement second) { 12 26 … … 37 51 * in the list. If there is no common denominator, the method returns null. 38 52 * </p> 53 * 54 * @param guiElements the gui elements 55 * @return the common denominator 39 56 */ 40 57 private static IGUIElement getCommonDenominator( … … 99 116 } 100 117 101 /** 102 * 103 */ 118 /** The Constant serialVersionUID. */ 104 119 private static final long serialVersionUID = -2593092958275693133L; 105 120 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Constants.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 6 // TODO: Auto-generated Javadoc 7 /** 8 * The Class Constants. 9 */ 3 10 public class Constants { 4 11 12 /** The Constant GAP_SYMBOL. */ 5 13 public static final int GAP_SYMBOL = -1; 14 15 /** The Constant UNMATCHED_SYMBOL. */ 6 16 public static final int UNMATCHED_SYMBOL = -2; 7 17 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Match.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 … … 5 8 import java.util.LinkedList; 6 9 10 // TODO: Auto-generated Javadoc 11 /** 12 * The Class Match. 13 */ 7 14 public class Match implements Serializable { 8 /** 9 * 10 */ 15 16 /** The Constant serialVersionUID. */ 11 17 private static final long serialVersionUID = -3206992723755714741L; 12 18 19 /** The matchseqs. */ 13 20 private final ArrayList<NumberSequence> matchseqs; 14 21 22 /** The occurences. */ 15 23 private LinkedList<MatchOccurence> occurences; 16 24 25 /** 26 * Instantiates a new match. 27 */ 17 28 public Match() { 18 29 matchseqs = new ArrayList<NumberSequence>(2); … … 22 33 } 23 34 35 /** 36 * Adds the occurence. 37 * 38 * @param occurence the occurence 39 */ 24 40 public void addOccurence(MatchOccurence occurence) { 25 41 occurences.add(occurence); 26 42 } 27 43 44 /** 45 * Adds the occurences of. 46 * 47 * @param m the m 48 */ 28 49 public void addOccurencesOf(Match m) { 29 50 occurences.addAll(m.getOccurences()); 30 51 } 31 52 53 /** 54 * Equals. 55 * 56 * @param m the m 57 * @return true, if successful 58 */ 32 59 public boolean equals(Match m) { 33 60 if ((m.getFirstSequence().equals(this.getFirstSequence()) || m … … 40 67 } 41 68 69 /** 70 * Gets the first sequence. 71 * 72 * @return the first sequence 73 */ 42 74 public NumberSequence getFirstSequence() { 43 75 return matchseqs.get(0); 44 76 } 45 77 78 /** 79 * Gets the occurences. 80 * 81 * @return the occurences 82 */ 46 83 public LinkedList<MatchOccurence> getOccurences() { 47 84 return occurences; 48 85 } 49 86 87 /** 88 * Gets the second sequence. 89 * 90 * @return the second sequence 91 */ 50 92 public NumberSequence getSecondSequence() { 51 93 return matchseqs.get(1); 52 94 } 53 95 96 /** 97 * Occurence count. 98 * 99 * @return the int 100 */ 54 101 public int occurenceCount() { 55 102 return occurences.size(); 56 103 } 57 104 105 /** 106 * Sets the first sequence. 107 * 108 * @param seq the new first sequence 109 */ 58 110 public void setFirstSequence(NumberSequence seq) { 59 111 matchseqs.set(0, seq); 60 112 } 61 113 114 /** 115 * Sets the occurences. 116 * 117 * @param occurences the new occurences 118 */ 62 119 public void setOccurences(LinkedList<MatchOccurence> occurences) { 63 120 this.occurences = occurences; 64 121 } 65 122 123 /** 124 * Sets the second sequence. 125 * 126 * @param seq the new second sequence 127 */ 66 128 public void setSecondSequence(NumberSequence seq) { 67 129 matchseqs.set(1, seq); 68 130 } 69 131 132 /** 133 * Size. 134 * 135 * @return the int 136 */ 70 137 public int size() { 71 138 // Both sequences should be equally long -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/MatchOccurence.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 3 6 import java.io.Serializable; 4 7 8 // TODO: Auto-generated Javadoc 9 /** 10 * The Class MatchOccurence. 11 */ 5 12 public class MatchOccurence implements Serializable { 6 /** 7 * 8 */ 13 14 /** The Constant serialVersionUID. */ 9 15 private static final long serialVersionUID = 6186633243145293781L; 16 17 /** The startindex. */ 10 18 private int startindex; 19 20 /** The endindex. */ 11 21 private int endindex; 22 23 /** The sequence id. */ 12 24 private int sequenceId; 13 25 26 /** 27 * Instantiates a new match occurence. 28 * 29 * @param startindex the startindex 30 * @param endindex the endindex 31 * @param sequenceId the sequence id 32 */ 14 33 public MatchOccurence(int startindex, int endindex, int sequenceId) { 15 34 this.startindex = startindex; … … 18 37 } 19 38 39 /** 40 * Gets the endindex. 41 * 42 * @return the endindex 43 */ 20 44 public int getEndindex() { 21 45 return endindex; 22 46 } 23 47 48 /** 49 * Gets the sequence id. 50 * 51 * @return the sequence id 52 */ 24 53 public int getSequenceId() { 25 54 return sequenceId; 26 55 } 27 56 57 /** 58 * Gets the startindex. 59 * 60 * @return the startindex 61 */ 28 62 public int getStartindex() { 29 63 return startindex; 30 64 } 31 65 66 /** 67 * Sets the endindex. 68 * 69 * @param endindex the new endindex 70 */ 32 71 public void setEndindex(int endindex) { 33 72 this.endindex = endindex; 34 73 } 35 74 75 /** 76 * Sets the sequence id. 77 * 78 * @param sequenceId the new sequence id 79 */ 36 80 public void setSequenceId(int sequenceId) { 37 81 this.sequenceId = sequenceId; 38 82 } 39 83 84 /** 85 * Sets the startindex. 86 * 87 * @param startindex the new startindex 88 */ 40 89 public void setStartindex(int startindex) { 41 90 this.startindex = startindex; -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/MatrixEntry.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 6 // TODO: Auto-generated Javadoc 7 /** 8 * The Class MatrixEntry. 9 */ 3 10 public class MatrixEntry { 11 12 /** The score. */ 4 13 private double score; 14 15 /** The previous. */ 5 16 private MatrixEntry previous; 17 18 /** The xvalue. */ 6 19 private int xvalue; 20 21 /** The yvalue. */ 7 22 private int yvalue; 8 23 24 /** 25 * Instantiates a new matrix entry. 26 */ 9 27 public MatrixEntry() { 10 28 } 11 29 30 /** 31 * Instantiates a new matrix entry. 32 * 33 * @param score the score 34 * @param previous the previous 35 */ 12 36 public MatrixEntry(float score, MatrixEntry previous) { 13 37 this.score = score; … … 15 39 } 16 40 41 /** 42 * Gets the previous. 43 * 44 * @return the previous 45 */ 17 46 public MatrixEntry getPrevious() { 18 47 return previous; 19 48 } 20 49 50 /** 51 * Gets the score. 52 * 53 * @return the score 54 */ 21 55 public double getScore() { 22 56 return score; 23 57 } 24 58 59 /** 60 * Gets the xvalue. 61 * 62 * @return the xvalue 63 */ 25 64 public int getXvalue() { 26 65 return xvalue; 27 66 } 28 67 68 /** 69 * Gets the yvalue. 70 * 71 * @return the yvalue 72 */ 29 73 public int getYvalue() { 30 74 return yvalue; 31 75 } 32 76 77 /** 78 * Sets the previous. 79 * 80 * @param previous the new previous 81 */ 33 82 public void setPrevious(MatrixEntry previous) { 34 83 this.previous = previous; 35 84 } 36 85 86 /** 87 * Sets the score. 88 * 89 * @param score the new score 90 */ 37 91 public void setScore(double score) { 38 92 this.score = score; 39 93 } 40 94 95 /** 96 * Sets the xvalue. 97 * 98 * @param xvalue the new xvalue 99 */ 41 100 public void setXvalue(int xvalue) { 42 101 this.xvalue = xvalue; 43 102 } 44 103 104 /** 105 * Sets the yvalue. 106 * 107 * @param yvalue the new yvalue 108 */ 45 109 public void setYvalue(int yvalue) { 46 110 this.yvalue = yvalue; -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NeedlemanWunsch.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 … … 8 11 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 9 12 13 // TODO: Auto-generated Javadoc 14 /** 15 * The Class NeedlemanWunsch. 16 */ 10 17 public class NeedlemanWunsch implements AlignmentAlgorithm { 11 18 12 /** 13 * The first input 14 */ 19 /** The first input. */ 15 20 private int[] input1; 16 21 17 /** 18 * The second input String 19 */ 22 /** The second input String. */ 20 23 private int[] input2; 21 24 22 /** 23 * The lengths of the input 24 */ 25 /** The lengths of the input. */ 25 26 private int length1, length2; 26 27 … … 31 32 private MatrixEntry[][] matrix; 32 33 34 /** The alignment. */ 33 35 private ArrayList<NumberSequence> alignment; 34 36 35 /** 36 * Substitution matrix to calculate scores 37 */ 37 /** Substitution matrix to calculate scores. */ 38 38 private SubstitutionMatrix submat; 39 39 40 /* (non-Javadoc) 41 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#align(de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence, de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence, de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix, float) 42 */ 40 43 @Override 41 44 public void align(NumberSequence input1, NumberSequence input2, … … 155 158 } 156 159 160 /* (non-Javadoc) 161 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getMatches() 162 */ 157 163 @Override 158 164 public ArrayList<Match> getMatches() { … … 163 169 /** 164 170 * Get the maximum value in the score matrix. 171 * 172 * @return the max score 165 173 */ 166 174 @Override … … 180 188 } 181 189 190 /* (non-Javadoc) 191 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#printAlignment() 192 */ 182 193 @Override 183 194 public void printAlignment() { … … 210 221 211 222 /** 212 * print the dynmaic programming matrix 223 * print the dynmaic programming matrix. 213 224 */ 214 225 @Override … … 232 243 } 233 244 245 /** 246 * Sets the alignment. 247 * 248 * @param alignment the new alignment 249 */ 234 250 public void setAlignment(ArrayList<NumberSequence> alignment) { 235 251 this.alignment = alignment; … … 250 266 } 251 267 268 /** 269 * Traceback. 270 */ 252 271 public void traceback() { 253 272 MatrixEntry tmp = matrix[length1][length2]; -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 … … 5 8 import java.util.Random; 6 9 10 // TODO: Auto-generated Javadoc 11 /** 12 * The Class NumberSequence. 13 */ 7 14 public class NumberSequence implements Serializable { 8 /** 9 * 10 */ 15 16 /** The Constant serialVersionUID. */ 11 17 private static final long serialVersionUID = -4604570107534055589L; 18 19 /** The sequence. */ 12 20 private int[] sequence; 21 22 /** The id. */ 13 23 private int id; 14 24 25 /** 26 * Instantiates a new number sequence. 27 * 28 * @param size the size 29 */ 15 30 public NumberSequence(int size) { 16 31 … … 19 34 20 35 // Searching occurrences of pattern 36 /** 37 * Contains pattern. 38 * 39 * @param pattern the pattern 40 * @return the linked list 41 */ 21 42 public LinkedList<Integer> containsPattern(Match pattern) { 22 43 final LinkedList<Integer> result = new LinkedList<Integer>(); … … 34 55 } 35 56 57 /** 58 * Equals. 59 * 60 * @param n the n 61 * @return true, if successful 62 */ 36 63 public boolean equals(NumberSequence n) { 37 64 final int[] seq = n.getSequence(); … … 48 75 49 76 // Returns the number of times event occurs in this sequence 77 /** 78 * Event count. 79 * 80 * @param event the event 81 * @return the int 82 */ 50 83 public int eventCount(int event) { 51 84 int count = 0; … … 58 91 } 59 92 93 /** 94 * Gets the id. 95 * 96 * @return the id 97 */ 60 98 public int getId() { 61 99 return id; 62 100 } 63 101 102 /** 103 * Gets the sequence. 104 * 105 * @return the sequence 106 */ 64 107 public int[] getSequence() { 65 108 return sequence; … … 67 110 68 111 // Recursive check if sequence contains pattern at position i 112 /** 113 * Matches. 114 * 115 * @param i the i 116 * @param p1 the p1 117 * @param p2 the p2 118 * @param ip1 the ip1 119 * @param ip2 the ip2 120 * @param jumped1 the jumped1 121 * @param jumped2 the jumped2 122 * @param hadSelection the had selection 123 * @param matchseq1 the matchseq1 124 * @param matchseq2 the matchseq2 125 * @return true, if successful 126 */ 69 127 private boolean matches(int i, int[] p1, int[] p2, int ip1, int ip2, 70 128 boolean jumped1, // True if there was a gap in Sequence 1 of the … … 134 192 } 135 193 194 /** 195 * Prints the sequence. 196 */ 136 197 public void printSequence() { 137 198 for (int i = 0; i < sequence.length; i++) { … … 141 202 } 142 203 204 /** 205 * Sets the id. 206 * 207 * @param id the new id 208 */ 143 209 public void setId(int id) { 144 210 this.id = id; 145 211 } 146 212 213 /** 214 * Sets the sequence. 215 * 216 * @param sequence the new sequence 217 */ 147 218 public void setSequence(int[] sequence) { 148 219 this.sequence = sequence; 149 220 } 150 221 222 /** 223 * Shuffle. 224 * 225 * @return the number sequence 226 */ 151 227 public NumberSequence shuffle() { 152 228 final NumberSequence result = new NumberSequence(sequence.length); … … 165 241 } 166 242 243 /** 244 * Size. 245 * 246 * @return the int 247 */ 167 248 public int size() { 168 249 return sequence.length; -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWaterman.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 … … 8 11 import de.ugoe.cs.util.console.Console; 9 12 13 // TODO: Auto-generated Javadoc 14 /** 15 * The Class SmithWaterman. 16 */ 10 17 public class SmithWaterman implements AlignmentAlgorithm { 11 18 12 /** 13 * The first input 14 */ 19 /** The first input. */ 15 20 private int[] input1; 16 21 17 /** 18 * The second input String 19 */ 22 /** The second input String. */ 20 23 private int[] input2; 21 24 22 /** 23 * The lengths of the input 24 */ 25 /** The lengths of the input. */ 25 26 private int length1, length2; 26 27 … … 31 32 private MatrixEntry[][] matrix; 32 33 34 /** The alignment. */ 33 35 private ArrayList<NumberSequence> alignment; 34 36 35 /** 36 * Substitution matrix to calculate scores 37 */ 37 /** Substitution matrix to calculate scores. */ 38 38 private SubstitutionMatrix submat; 39 39 40 /* (non-Javadoc) 41 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#align(de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence, de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence, de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix, float) 42 */ 40 43 @Override 41 44 public void align(NumberSequence input1, NumberSequence input2, … … 163 166 } 164 167 168 /* (non-Javadoc) 169 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getMatches() 170 */ 165 171 @Override 166 172 public ArrayList<Match> getMatches() { … … 171 177 /** 172 178 * Get the maximum value in the score matrix. 179 * 180 * @return the max score 173 181 */ 174 182 @Override … … 188 196 } 189 197 198 /* (non-Javadoc) 199 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#printAlignment() 200 */ 190 201 @Override 191 202 public void printAlignment() { … … 223 234 224 235 /** 225 * print the dynmaic programming matrix 236 * print the dynmaic programming matrix. 226 237 */ 227 238 @Override … … 245 256 } 246 257 258 /** 259 * Sets the alignment. 260 * 261 * @param alignment the new alignment 262 */ 247 263 public void setAlignment(ArrayList<NumberSequence> alignment) { 248 264 this.alignment = alignment; … … 263 279 } 264 280 281 /** 282 * Traceback. 283 */ 265 284 public void traceback() { 266 285 MatrixEntry tmp = matrix[length1][length2]; -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/SmithWatermanRepeated.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 2 5 … … 8 11 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 9 12 13 // TODO: Auto-generated Javadoc 14 /** 15 * The Class SmithWatermanRepeated. 16 */ 10 17 public class SmithWatermanRepeated implements AlignmentAlgorithm { 11 18 12 /** 13 * The first input 14 */ 19 /** The first input. */ 15 20 private int[] input1; 16 21 17 /** 18 * The second input String 19 */ 22 /** The second input String. */ 20 23 private int[] input2; 21 24 22 /** 23 * The lengths of the input 24 */ 25 /** The lengths of the input. */ 25 26 private int length1, length2; 26 27 … … 31 32 private MatrixEntry[][] matrix; 32 33 34 /** The alignment. */ 33 35 private ArrayList<NumberSequence> alignment; 34 36 37 /** The score threshold. */ 35 38 private float scoreThreshold; 36 39 37 /** 38 * Substitution matrix to calculate scores 39 */ 40 /** Substitution matrix to calculate scores. */ 40 41 private SubstitutionMatrix submat; 41 42 43 /** 44 * Instantiates a new smith waterman repeated. 45 */ 42 46 public SmithWatermanRepeated() { 43 47 44 48 } 45 49 50 /* (non-Javadoc) 51 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#align(de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence, de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence, de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix, float) 52 */ 46 53 @Override 47 54 public void align(NumberSequence input1, NumberSequence input2, … … 219 226 } 220 227 228 /* (non-Javadoc) 229 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getMatches() 230 */ 221 231 @Override 222 232 public ArrayList<Match> getMatches() { … … 265 275 /** 266 276 * Get the maximum value in the score matrix. 277 * 278 * @return the max score 267 279 */ 268 280 @Override … … 282 294 } 283 295 296 /* (non-Javadoc) 297 * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#printAlignment() 298 */ 284 299 @Override 285 300 public void printAlignment() { … … 312 327 313 328 /** 314 * print the dynmaic programming matrix 329 * print the dynmaic programming matrix. 315 330 */ 316 331 @Override … … 337 352 } 338 353 354 /** 355 * Sets the alignment. 356 * 357 * @param alignment the new alignment 358 */ 339 359 public void setAlignment(ArrayList<NumberSequence> alignment) { 340 360 this.alignment = alignment; … … 355 375 } 356 376 377 /** 378 * Traceback. 379 */ 357 380 public void traceback() { 358 381 MatrixEntry tmp = matrix[length1 + 1][0].getPrevious(); -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DifferenceSubstitutionMatrix.java
r1733 r1734 9 9 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 10 10 11 // TODO: Auto-generated Javadoc 11 12 /** 13 * The Class DifferenceSubstitutionMatrix. 14 * 12 15 * @author Ralph Krimmel 13 *14 16 */ 15 17 public class DifferenceSubstitutionMatrix implements SubstitutionMatrix { 16 18 19 /** The input1. */ 17 20 private final int[] input1; 21 22 /** The input2. */ 18 23 private final int[] input2; 24 25 /** The max value. */ 19 26 private final int maxValue; 20 27 28 /** 29 * Instantiates a new difference substitution matrix. 30 * 31 * @param input1 the input1 32 * @param input2 the input2 33 */ 21 34 public DifferenceSubstitutionMatrix(int[] input1, int[] input2) { 22 35 this.input1 = input1; … … 25 38 } 26 39 40 /* (non-Javadoc) 41 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 42 */ 27 43 @Override 28 44 public void generate(HashSet<ITask> uniqueTasks) { 29 45 } 30 46 47 /* (non-Javadoc) 48 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 49 */ 31 50 @Override 32 51 public float getGapPenalty() { … … 34 53 } 35 54 55 /** 56 * Gets the max value. 57 * 58 * @return the max value 59 */ 36 60 private int getMaxValue() { 37 61 int max = input1[0]; … … 61 85 } 62 86 87 /* (non-Javadoc) 88 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) 89 */ 63 90 @Override 64 91 public void update(LinkedList<ITask> newlyGeneratedTasks) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DummySubstitutionMatrix.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 … … 6 9 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 7 10 11 // TODO: Auto-generated Javadoc 12 /** 13 * The Class DummySubstitutionMatrix. 14 */ 8 15 public class DummySubstitutionMatrix implements SubstitutionMatrix { 9 16 17 /* (non-Javadoc) 18 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 19 */ 10 20 @Override 11 21 public void generate(HashSet<ITask> uniqueTasks) { 12 22 } 13 23 24 /* (non-Javadoc) 25 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 26 */ 14 27 @Override 15 28 public float getGapPenalty() { … … 17 30 } 18 31 32 /* (non-Javadoc) 33 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getScore(int, int) 34 */ 19 35 @Override 20 36 public float getScore(int pos1, int pos2) { … … 26 42 } 27 43 44 /* (non-Javadoc) 45 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) 46 */ 28 47 @Override 29 48 public void update(LinkedList<ITask> newlyGeneratedTasks) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/DynamicTriangleMatrix.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 3 6 import java.util.ArrayList; 4 7 8 // TODO: Auto-generated Javadoc 5 9 //Must be initialized! 10 /** 11 * The Class DynamicTriangleMatrix. 12 */ 6 13 public class DynamicTriangleMatrix implements ITriangleMatrix { 7 14 15 /** The matrix. */ 8 16 private final ArrayList<Float> matrix; 17 18 /** The size. */ 9 19 protected int size; 20 21 /** The initalization value. */ 10 22 private float initalizationValue; 11 23 24 /** 25 * Instantiates a new dynamic triangle matrix. 26 * 27 * @param size the size 28 */ 12 29 public DynamicTriangleMatrix(int size) { 13 30 this.size = size; … … 81 98 } 82 99 100 /* (non-Javadoc) 101 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#size() 102 */ 83 103 @Override 84 104 public int size() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/EventTaskInstancesListGenerator.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 … … 7 10 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 8 11 12 // TODO: Auto-generated Javadoc 13 /** 14 * The Class EventTaskInstancesListGenerator. 15 */ 9 16 public class EventTaskInstancesListGenerator extends 10 17 DefaultTaskTraversingVisitor { 11 18 19 /** The eventlist. */ 12 20 private LinkedList<IEventTaskInstance> eventlist; 13 21 22 /** 23 * Instantiates a new event task instances list generator. 24 */ 14 25 public EventTaskInstancesListGenerator() { 15 26 eventlist = new LinkedList<IEventTaskInstance>(); 16 27 } 17 28 29 /** 30 * Gets the eventlist. 31 * 32 * @return the eventlist 33 */ 18 34 public LinkedList<IEventTaskInstance> getEventlist() { 19 35 return eventlist; 20 36 } 21 37 38 /** 39 * Sets the eventlist. 40 * 41 * @param eventlist the new eventlist 42 */ 22 43 public void setEventlist(LinkedList<IEventTaskInstance> eventlist) { 23 44 this.eventlist = eventlist; 24 45 } 25 46 47 /* (non-Javadoc) 48 * @see de.ugoe.cs.autoquest.tasktrees.treeifc.DefaultTaskTraversingVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask) 49 */ 26 50 @Override 27 51 public void visit(IEventTask eventTask) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ITriangleMatrix.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 6 // TODO: Auto-generated Javadoc 7 /** 8 * The Interface ITriangleMatrix. 9 */ 3 10 public interface ITriangleMatrix { 4 11 12 /** 13 * Gets the. 14 * 15 * @param first the first 16 * @param second the second 17 * @return the float 18 */ 5 19 public abstract float get(int first, int second); 6 20 7 21 // Increases the size 22 /** 23 * Increase size. 24 * 25 * @param count the count 26 * @throws Exception the exception 27 */ 8 28 public abstract void increaseSize(int count) throws Exception; 9 29 30 /** 31 * Initialize. 32 * 33 * @param value the value 34 */ 10 35 public abstract void initialize(float value); 11 36 37 /** 38 * Sets the. 39 * 40 * @param first the first 41 * @param second the second 42 * @param value the value 43 */ 12 44 public abstract void set(int first, int second, float value); 13 45 46 /** 47 * Size. 48 * 49 * @return the int 50 */ 14 51 public abstract int size(); 15 52 53 /** 54 * To string. 55 * 56 * @return the string 57 */ 16 58 @Override 17 59 public abstract String toString(); -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java
r1733 r1734 9 9 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 10 10 11 // TODO: Auto-generated Javadoc 11 12 /** 13 * The Class NearbySubstitutionMatrix. 14 * 12 15 * @author Ralph Krimmel 13 *14 16 */ 15 17 public class NearbySubstitutionMatrix implements SubstitutionMatrix { 16 18 19 /** The input1. */ 17 20 private final int[] input1; 21 22 /** The input2. */ 18 23 private final int[] input2; 24 25 /** The range. */ 19 26 private final int range; 20 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 */ 21 35 public NearbySubstitutionMatrix(int[] input1, int[] input2, int range) { 22 36 this.input1 = input1; … … 25 39 } 26 40 41 /* (non-Javadoc) 42 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 43 */ 27 44 @Override 28 45 public void generate(HashSet<ITask> uniqueTasks) { 29 46 } 30 47 48 /* (non-Javadoc) 49 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 50 */ 31 51 @Override 32 52 public float getGapPenalty() { … … 51 71 } 52 72 73 /* (non-Javadoc) 74 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) 75 */ 53 76 @Override 54 77 public void update(LinkedList<ITask> newlyGeneratedTasks) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/ObjectDistanceSubstitionMatrix.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 … … 17 20 import de.ugoe.cs.util.console.Console; 18 21 22 // TODO: Auto-generated Javadoc 23 /** 24 * The Class ObjectDistanceSubstitionMatrix. 25 */ 19 26 public class ObjectDistanceSubstitionMatrix implements SubstitutionMatrix, 20 27 Serializable { 21 28 22 /** 23 * 24 */ 29 /** The Constant serialVersionUID. */ 25 30 private static final long serialVersionUID = -4253258274617754083L; 31 32 /** The idmapping. */ 26 33 private final HashMap<Integer, Integer> idmapping; 34 35 /** The matrix. */ 27 36 private ITriangleMatrix matrix; 37 38 /** The unique tasks. */ 28 39 private HashSet<ITask> uniqueTasks; 40 41 /** The gap penalty. */ 29 42 private float gapPenalty; 43 44 /** The index. */ 30 45 private int index = 0; 46 47 /** The etis of tasks. */ 31 48 private final HashMap<Integer, LinkedList<IEventTaskInstance>> etisOfTasks; 49 50 /** The calculate non task instances. */ 32 51 private boolean calculateNonTaskInstances = true; 52 53 /** The first round max index. */ 33 54 private int firstRoundMaxIndex = 0; 34 55 56 /** The positive threshold. */ 35 57 private final double positiveThreshold; 36 58 59 /** 60 * Instantiates a new object distance substition matrix. 61 * 62 * @param positiveThreshold the positive threshold 63 * @param gapPenalty the gap penalty 64 * @param calculateNonTaskInstances the calculate non task instances 65 */ 37 66 public ObjectDistanceSubstitionMatrix(float positiveThreshold, 38 67 int gapPenalty, boolean calculateNonTaskInstances) { … … 45 74 } 46 75 76 /** 77 * Compute distance. 78 * 79 * @param task1 the task1 80 * @param task2 the task2 81 */ 47 82 private void computeDistance(ITask task1, ITask task2) { 48 83 int index1 = -1; … … 92 127 } 93 128 129 /** 130 * Distance between instances. 131 * 132 * @param eti1 the eti1 133 * @param eti2 the eti2 134 * @return the float 135 */ 94 136 private float distanceBetweenInstances(IEventTaskInstance eti1, 95 137 IEventTaskInstance eti2) { … … 101 143 } 102 144 145 /** 146 * Distance between task and instance. 147 * 148 * @param task1 the task1 149 * @param eti1 the eti1 150 * @return the float 151 */ 103 152 private float distanceBetweenTaskAndInstance(ITask task1, 104 153 IEventTaskInstance eti1) { … … 127 176 } 128 177 178 /** 179 * Distance between tasks. 180 * 181 * @param task1 the task1 182 * @param task2 the task2 183 * @return the float 184 */ 129 185 private float distanceBetweenTasks(ITask task1, ITask task2) { 130 186 if (this.calculateNonTaskInstances) { … … 144 200 } 145 201 202 /* (non-Javadoc) 203 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 204 */ 146 205 @Override 147 206 public void generate(HashSet<ITask> uniqueTasks) { … … 174 233 } 175 234 235 /* (non-Javadoc) 236 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 237 */ 176 238 @Override 177 239 public float getGapPenalty() { … … 179 241 } 180 242 243 /** 244 * Gets the index. 245 * 246 * @param eti the eti 247 * @return the index 248 */ 181 249 synchronized private int getIndex(IEventTaskInstance eti) { 182 250 int tempindex = -1; … … 191 259 } 192 260 261 /** 262 * Gets the index. 263 * 264 * @param task the task 265 * @return the index 266 */ 193 267 synchronized private int getIndex(ITask task) { 194 268 int tempindex = -1; … … 211 285 // } 212 286 287 /* (non-Javadoc) 288 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getScore(int, int) 289 */ 213 290 @Override 214 291 public float getScore(int taskId1, int taskId2) { … … 230 307 231 308 // TODO: Merge this with updateEventTaskInstances 309 /** 310 * Search event task instances. 311 */ 232 312 private void searchEventTaskInstances() { 233 313 for (final Iterator<ITask> it = uniqueTasks.iterator(); it.hasNext();) { … … 243 323 } 244 324 325 /** 326 * Sets the gap penalty. 327 * 328 * @param gapPenalty the new gap penalty 329 */ 245 330 public void setGapPenalty(float gapPenalty) { 246 331 this.gapPenalty = gapPenalty; 247 332 }; 248 333 334 /* (non-Javadoc) 335 * @see java.lang.Object#toString() 336 */ 249 337 @Override 250 338 public String toString() { … … 253 341 254 342 // Just Calculate the distance between the new tasks and the matrix. 343 /* (non-Javadoc) 344 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) 345 */ 255 346 @Override 256 347 public void update(LinkedList<ITask> newTasks) { … … 277 368 } 278 369 370 /** 371 * Update event task instances. 372 * 373 * @param newTasks the new tasks 374 */ 279 375 public void updateEventTaskInstances(LinkedList<ITask> newTasks) { 280 376 for (final Iterator<ITask> it = newTasks.iterator(); it.hasNext();) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/StaticTriangleMatrix.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 3 6 import java.io.Serializable; 4 7 8 // TODO: Auto-generated Javadoc 9 /** 10 * The Class StaticTriangleMatrix. 11 */ 5 12 public class StaticTriangleMatrix implements ITriangleMatrix, Serializable { 6 13 7 /** 8 * 9 */ 14 /** The Constant serialVersionUID. */ 10 15 private static final long serialVersionUID = 7599542322424894866L; 16 17 /** The matrix. */ 11 18 private final float[] matrix; 19 20 /** The size. */ 12 21 protected int size; 13 22 23 /** 24 * Instantiates a new static triangle matrix. 25 * 26 * @param size the size 27 */ 14 28 public StaticTriangleMatrix(int size) { 15 29 this.size = size; … … 17 31 } 18 32 33 /* (non-Javadoc) 34 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#get(int, int) 35 */ 19 36 @Override 20 37 public float get(int first, int second) { … … 25 42 } 26 43 44 /* (non-Javadoc) 45 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#increaseSize(int) 46 */ 27 47 @Override 28 48 public void increaseSize(int count) throws Exception { … … 32 52 } 33 53 54 /* (non-Javadoc) 55 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#initialize(float) 56 */ 34 57 @Override 35 58 public void initialize(float value) { … … 39 62 } 40 63 64 /* (non-Javadoc) 65 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#set(int, int, float) 66 */ 41 67 @Override 42 68 public void set(int first, int second, float value) { … … 46 72 } 47 73 74 /* (non-Javadoc) 75 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#size() 76 */ 48 77 @Override 49 78 public int size() { … … 51 80 } 52 81 82 /* (non-Javadoc) 83 * @see java.lang.Object#toString() 84 */ 53 85 @Override 54 86 public String toString() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/SubstitutionMatrix.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 … … 6 9 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 7 10 11 // TODO: Auto-generated Javadoc 12 /** 13 * The Interface SubstitutionMatrix. 14 */ 8 15 public interface SubstitutionMatrix { 9 16 17 /** 18 * Generate. 19 * 20 * @param uniqueTasks the unique tasks 21 */ 10 22 public void generate(HashSet<ITask> uniqueTasks); 11 23 24 /** 25 * Gets the gap penalty. 26 * 27 * @return the gap penalty 28 */ 12 29 public float getGapPenalty(); 13 30 31 /** 32 * Gets the score. 33 * 34 * @param pos1 the pos1 35 * @param pos2 the pos2 36 * @return the score 37 */ 14 38 public float getScore(int pos1, int pos2); 15 39 40 /** 41 * Update. 42 * 43 * @param newlyGeneratedTasks the newly generated tasks 44 */ 16 45 public void update(LinkedList<ITask> newlyGeneratedTasks); 17 46 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/UPGMAMatrix.java
r1733 r1734 1 /* 2 * 3 */ 1 4 package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 2 5 6 // TODO: Auto-generated Javadoc 7 /** 8 * The Class UPGMAMatrix. 9 */ 3 10 public class UPGMAMatrix extends StaticTriangleMatrix { 4 11 12 /** 13 * Instantiates a new UPGMA matrix. 14 * 15 * @param size the size 16 */ 5 17 public UPGMAMatrix(int size) { 6 18 super(size); 7 19 } 8 20 21 /* (non-Javadoc) 22 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.StaticTriangleMatrix#size() 23 */ 9 24 @Override 10 25 public int size() { … … 12 27 } 13 28 29 /* (non-Javadoc) 30 * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.StaticTriangleMatrix#toString() 31 */ 14 32 @Override 15 33 public String toString() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/ComponentManager.java
r1733 r1734 21 21 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 22 22 23 // TODO: Auto-generated Javadoc 23 24 /** 24 25 * <p> … … 28 29 * well as the default task factory. 29 30 * </p> 30 * 31 * 32 * @author pharms 31 33 * @version 1.0 32 * @author pharms33 34 */ 34 35 public class ComponentManager { … … 47 48 * <p> 48 49 * returns the default task builder 49 * </p> 50 * 50 * </p>. 51 * 51 52 * @return as described 52 53 */ … … 58 59 * <p> 59 60 * returns the default task factory 60 * </p> 61 * 61 * </p>. 62 * 62 63 * @return as described 63 64 */ … … 69 70 * <p> 70 71 * returns the singleton instance of this class 71 * </p> 72 * 72 * </p>. 73 * 73 74 * @return as described 74 75 */ … … 84 85 * <p> 85 86 * returns the default temporal relationship rule manager 86 * </p> 87 * 87 * </p>. 88 * 88 89 * @return as described 89 90 */ … … 92 93 } 93 94 94 /** 95 * <p> 96 * singleton instance of this class 97 * </p> 98 */ 95 /** <p> singleton instance of this class </p>. */ 99 96 private static ComponentManager instance; 100 97 101 /** 102 * <p> 103 * the default temporal relationship rule manager 104 * </p> 105 */ 98 /** <p> the default temporal relationship rule manager </p>. */ 106 99 private TemporalRelationshipRuleManager temporalRelationshipRuleManager; 107 100 108 /** 109 * <p> 110 * the default task builder 111 * </p> 112 */ 101 /** <p> the default task builder </p>. */ 113 102 private ITaskBuilder taskBuilder; 114 103 115 /** 116 * <p> 117 * the default task factory 118 * </p> 119 */ 104 /** <p> the default task factory </p>. */ 120 105 private ITaskFactory taskFactory; 121 106 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/TaskTreeManager.java
r1733 r1734 28 28 import de.ugoe.cs.util.console.Console; 29 29 30 // TODO: Auto-generated Javadoc 30 31 /** 31 32 * <p> … … 37 38 * well. 38 39 * </p> 39 * 40 * 41 * @author pharms 40 42 * @version 1.0 41 * @author pharms42 43 */ 43 44 public class TaskTreeManager { 44 45 45 /** 46 * <p> 47 * the internally used task builder 48 * </p> 49 */ 46 /** <p> the internally used task builder </p>. */ 50 47 private final ITaskBuilder taskBuilder = ComponentManager 51 48 .getDefaultTaskBuilder(); 52 49 53 /** 54 * <p> 55 * the internally used task factory 56 * </p> 57 */ 50 /** <p> the internally used task factory </p>. */ 58 51 private final ITaskFactory taskFactory = ComponentManager 59 52 .getDefaultTaskFactory(); 60 53 61 /** 62 * <p> 63 * if single events are provided, the user sessions collected so far 64 * </p> 65 */ 54 /** <p> if single events are provided, the user sessions collected so far </p>. */ 66 55 private List<IUserSession> sessions = null; 67 56 68 /** 69 * <p> 70 * if single events are provided, the currently collected user session 71 * </p> 72 */ 57 /** <p> if single events are provided, the currently collected user session </p>. */ 73 58 private IUserSession currentSession = null; 74 59 … … 76 61 * <p> 77 62 * initializes the task tree manager 78 * </p> 63 * </p>. 79 64 */ 80 65 public TaskTreeManager() { … … 85 70 * <p> 86 71 * internally asserts that there is a current session to add new events to 87 * </p> 72 * </p>. 88 73 */ 89 74 private void assertSessionSequence() { … … 103 88 * return value of this method. 104 89 * </p> 105 * 106 * @param newSessions 107 * the user sessions of which the task model shall be created 108 * 90 * 91 * @param newSessions the user sessions of which the task model shall be created 109 92 * @return the task model created from the user sessions 110 *111 * @throws IllegalStateException112 * if the task manager is already used by providing it with113 * single events114 93 */ 115 94 public synchronized ITaskModel createTaskModel( -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRule.java
r1733 r1734 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 23 23 24 // TODO: Auto-generated Javadoc 24 25 /** 25 26 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/GUIEventTaskComparisonRule.java
r1733 r1734 47 47 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 48 48 49 // TODO: Auto-generated Javadoc 49 50 /** 50 51 * <p> … … 457 458 * </p> 458 459 * 459 * @param interaction1 460 * the first mouse button interaction to compare 461 * @param interaction2 462 * the second mouse button interaction to compare 463 * @param eventTarget 464 * the event target on which the interactions happened (used 465 * within special comparisons like mouse clicks on buttons, where 466 * the coordinates can be ignored) 467 * @param equalityLevel 468 * the equality level to be checked for 469 * 460 * @param interaction1 the first mouse button interaction to compare 461 * @param interaction2 the second mouse button interaction to compare 462 * @param equalityLevel the equality level to be checked for 470 463 * @return as described 471 464 */ … … 573 566 574 567 /** 575 * 568 * Gets the equality. 569 * 570 * @param task1 the task1 571 * @param task2 the task2 572 * @param requiredEqualityLevel the required equality level 573 * @return the equality 576 574 */ 577 575 private TaskEquality getEquality(ITask task1, ITask task2, … … 618 616 619 617 /** 620 * 618 * Gets the equality. 619 * 620 * @param instance1 the instance1 621 * @param instance2 the instance2 622 * @param requiredEqualityLevel the required equality level 623 * @return the equality 621 624 */ 622 625 private TaskEquality getEquality(ITaskInstance instance1, -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/IterationComparisonRule.java
r1733 r1734 21 21 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 22 22 23 // TODO: Auto-generated Javadoc 23 24 /** 24 25 * <p> … … 79 80 * </tr> 80 81 * </table> 81 * 82 * 83 * @author 2012, last modified by $Author: patrick$ 82 84 * @version $Revision: $ $Date: 19.02.2012$ 83 * @author 2012, last modified by $Author: patrick$84 85 */ 85 86 public class IterationComparisonRule implements TaskComparisonRule { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SelectionComparisonRule.java
r1733 r1734 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 23 23 24 // TODO: Auto-generated Javadoc 24 25 /** 25 26 * <p> … … 36 37 * equality is checked for and this equality is ensured. 37 38 * </p> 38 * 39 * 40 * @author 2012, last modified by $Author: patrick$ 39 41 * @version $Revision: $ $Date: 19.02.2012$ 40 * @author 2012, last modified by $Author: patrick$41 42 */ 42 43 public class SelectionComparisonRule implements TaskComparisonRule { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SequenceComparisonRule.java
r1733 r1734 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 23 23 24 // TODO: Auto-generated Javadoc 24 25 /** 25 26 * <p> … … 29 30 * can not decide, if two sequences are syntactically or semantically equal. 30 31 * </p> 31 * 32 * 33 * @author 2012, last modified by $Author: patrick$ 32 34 * @version $Revision: $ $Date: 19.02.2012$ 33 * @author 2012, last modified by $Author: patrick$34 35 */ 35 36 public class SequenceComparisonRule implements TaskComparisonRule { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndIterationComparisonRule.java
r1733 r1734 20 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 21 21 22 // TODO: Auto-generated Javadoc 22 23 /** 23 24 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRule.java
r1733 r1734 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 23 23 24 // TODO: Auto-generated Javadoc 24 25 /** 25 26 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskComparisonRule.java
r1733 r1734 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 24 25 * to be called for a comparison. 25 26 * </p> 26 * 27 * 28 * @author 2012, last modified by $Author: patrick$ 27 29 * @version $Revision: $ $Date: 19.02.2012$ 28 * @author 2012, last modified by $Author: patrick$29 30 */ 30 31 public interface TaskComparisonRule { … … 33 34 * <p> 34 35 * checks, if the provided tasks are lexically equal 35 * </p> 36 * 37 * @param task1 38 * the first task to compare 39 * @param task2 40 * the second task to compare 41 * 36 * </p>. 37 * 38 * @param task1 the first task to compare 39 * @param task2 the second task to compare 42 40 * @return true, if the tasks are equal, false else 43 41 */ … … 47 45 * <p> 48 46 * checks, if the provided task instances are lexically equal 49 * </p> 50 * 51 * @param instance1 52 * the first task instance to compare 53 * @param instance2 54 * the second task instance to compare 55 * 47 * </p>. 48 * 49 * @param instance1 the first task instance to compare 50 * @param instance2 the second task instance to compare 56 51 * @return true, if the tasks are equal, false else 57 52 */ … … 62 57 * <p> 63 58 * checks, if the provided tasks are semantically equal 64 * </p> 65 * 66 * @param task1 67 * the first task to compare 68 * @param task2 69 * the second task to compare 70 * 59 * </p>. 60 * 61 * @param task1 the first task to compare 62 * @param task2 the second task to compare 71 63 * @return true, if the tasks are equal, false else 72 64 */ … … 76 68 * <p> 77 69 * checks, if the provided task instances are semantically equal 78 * </p> 79 * 80 * @param instance1 81 * the first task instance to compare 82 * @param instance2 83 * the second task instance to compare 84 * 70 * </p>. 71 * 72 * @param instance1 the first task instance to compare 73 * @param instance2 the second task instance to compare 85 74 * @return true, if the tasks are equal, false else 86 75 */ … … 91 80 * <p> 92 81 * checks, if the provided tasks are syntactically equal 93 * </p> 94 * 95 * @param task1 96 * the first task to compare 97 * @param task2 98 * the second task to compare 99 * 82 * </p>. 83 * 84 * @param task1 the first task to compare 85 * @param task2 the second task to compare 100 86 * @return true, if the tasks are equal, false else 101 87 */ … … 105 91 * <p> 106 92 * checks, if the provided task instances are syntactically equal 107 * </p> 108 * 109 * @param instance1 110 * the first task instance to compare 111 * @param instance2 112 * the second task instance to compare 113 * 93 * </p>. 94 * 95 * @param instance1 the first task instance to compare 96 * @param instance2 the second task instance to compare 114 97 * @return true, if the tasks are equal, false else 115 98 */ … … 152 135 * <p> 153 136 * checks if the rule is applicable for comparing the two provided tasks 154 * </p> 155 * 156 * @param task1 157 * the first task to compare 158 * @param task2 159 * the second task to compare 160 * 137 * </p>. 138 * 139 * @param task1 the first task to compare 140 * @param task2 the second task to compare 161 141 * @return true, if the rule is applicable, false else 162 142 */ … … 167 147 * checks if the rule is applicable for comparing the two provided task 168 148 * instances 169 * </p> 170 * 171 * @param instance1 172 * the first task instance to compare 173 * @param instance2 174 * the second task instance to compare 175 * 149 * </p>. 150 * 151 * @param instance1 the first task instance to compare 152 * @param instance2 the second task instance to compare 176 153 * @return true, if the rule is applicable, false else 177 154 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEquality.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 58 59 * are always also semantically equal. 59 60 * </p> 60 * 61 * 62 * @author 2012, last modified by $Author: patrick$ 61 63 * @version $Revision: $ $Date: 19.02.2012$ 62 * @author 2012, last modified by $Author: patrick$63 64 */ 64 65 public enum TaskEquality { 65 IDENTICAL, LEXICALLY_EQUAL, SYNTACTICALLY_EQUAL, SEMANTICALLY_EQUAL, UNEQUAL; 66 67 /** The identical. */ 68 IDENTICAL, 69 /** The lexically equal. */ 70 LEXICALLY_EQUAL, 71 /** The syntactically equal. */ 72 SYNTACTICALLY_EQUAL, 73 /** The semantically equal. */ 74 SEMANTICALLY_EQUAL, 75 /** The unequal. */ 76 UNEQUAL; 66 77 67 78 /** -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEqualityRuleManager.java
r1733 r1734 21 21 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 22 22 23 // TODO: Auto-generated Javadoc 23 24 /** 24 25 * <p> … … 37 38 * <p> 38 39 * returns the singleton instance of this class 39 * </p> 40 * 40 * </p>. 41 * 41 42 * @return as described 42 43 */ … … 45 46 } 46 47 47 /** 48 * <p> 49 * the singleton instance of this class 50 * </p> 51 */ 48 /** <p> the singleton instance of this class </p>. */ 52 49 private static final TaskEqualityRuleManager instance = new TaskEqualityRuleManager(); 53 50 54 /** 55 * <p> 56 * the rules that can be used for comparing tasks 57 * </p> 58 */ 51 /** <p> the rules that can be used for comparing tasks </p>. */ 59 52 private List<TaskComparisonRule> mRuleIndex = null; 60 53 … … 82 75 * returns true, if this level is given. 83 76 * </p> 84 * 85 * @param task1 86 * the first task to be compared 87 * @param task2 88 * the second task to be compared 89 * @param equalityLevel 90 * the level of equality to be checked for 91 * 92 * @return as described 93 * 94 * @throws IllegalStateException 95 * in the case, the {@link #init()} method was not called on the 96 * manager before a call to this method. 77 * 78 * @param task1 the first task to be compared 79 * @param task2 the second task to be compared 80 * @param equalityLevel the level of equality to be checked for 81 * @return as described 97 82 */ 98 83 public boolean areAtLeastEqual(ITask task1, ITask task2, … … 125 110 * equality level and returns true, if this level is given. 126 111 * </p> 127 * 128 * @param instance1 129 * the first task instance to be compared 130 * @param instance2 131 * the second task instance to be compared 132 * @param equalityLevel 133 * the level of equality to be checked for 134 * 135 * @return as described 136 * 137 * @throws IllegalStateException 138 * in the case, the {@link #init()} method was not called on the 139 * manager before a call to this method. 112 * 113 * @param instance1 the first task instance to be compared 114 * @param instance2 the second task instance to be compared 115 * @param equalityLevel the level of equality to be checked for 116 * @return as described 140 117 */ 141 118 public boolean areAtLeastEqual(ITaskInstance instance1, … … 170 147 * method returns false. 171 148 * </p> 172 * 173 * @param task1 174 * the first task to be compared 175 * @param task2 176 * the second task to be compared 177 * 178 * @return as described 179 * 180 * @throws IllegalStateException 181 * in the case, the {@link #init()} method was not called on the 182 * manager before a call to this method. 149 * 150 * @param task1 the first task to be compared 151 * @param task2 the second task to be compared 152 * @return as described 183 153 */ 184 154 public boolean areIdentical(ITask task1, ITask task2) { … … 204 174 * true, this method returns false. 205 175 * </p> 206 * 207 * @param instance1 208 * the first task instance to be compared 209 * @param instance2 210 * the second task instance to be compared 211 * 212 * @return as described 213 * 214 * @throws IllegalStateException 215 * in the case, the {@link #init()} method was not called on the 216 * manager before a call to this method. 176 * 177 * @param instance1 the first task instance to be compared 178 * @param instance2 the second task instance to be compared 179 * @return as described 217 180 */ 218 181 public boolean areIdentical(ITaskInstance instance1, ITaskInstance instance2) { … … 238 201 * this method returns false. 239 202 * </p> 240 * 241 * @param task1 242 * the first task to be compared 243 * @param task2 244 * the second task to be compared 245 * 246 * @return as described 247 * 248 * @throws IllegalStateException 249 * in the case, the {@link #init()} method was not called on the 250 * manager before a call to this method. 203 * 204 * @param task1 the first task to be compared 205 * @param task2 the second task to be compared 206 * @return as described 251 207 */ 252 208 public boolean areLexicallyEqual(ITask task1, ITask task2) { … … 272 228 * true, this method returns false. 273 229 * </p> 274 * 275 * @param instance1 276 * the first task instance to be compared 277 * @param instance2 278 * the second task instance to be compared 279 * 280 * @return as described 281 * 282 * @throws IllegalStateException 283 * in the case, the {@link #init()} method was not called on the 284 * manager before a call to this method. 230 * 231 * @param instance1 the first task instance to be compared 232 * @param instance2 the second task instance to be compared 233 * @return as described 285 234 */ 286 235 public boolean areLexicallyEqual(ITaskInstance instance1, … … 307 256 * true, this method returns false. 308 257 * </p> 309 * 310 * @param task1 311 * the first task to be compared 312 * @param task2 313 * the second task to be compared 314 * 315 * @return as described 316 * 317 * @throws IllegalStateException 318 * in the case, the {@link #init()} method was not called on the 319 * manager before a call to this method. 258 * 259 * @param task1 the first task to be compared 260 * @param task2 the second task to be compared 261 * @return as described 320 262 */ 321 263 public boolean areSemanticallyEqual(ITask task1, ITask task2) { … … 341 283 * returns true, this method returns false. 342 284 * </p> 343 * 344 * @param instance1 345 * the first task instance to be compared 346 * @param instance2 347 * the second task instance to be compared 348 * 349 * @return as described 350 * 351 * @throws IllegalStateException 352 * in the case, the {@link #init()} method was not called on the 353 * manager before a call to this method. 285 * 286 * @param instance1 the first task instance to be compared 287 * @param instance2 the second task instance to be compared 288 * @return as described 354 289 */ 355 290 public boolean areSemanticallyEqual(ITaskInstance instance1, … … 376 311 * true, this method returns false. 377 312 * </p> 378 * 379 * @param task1 380 * the first task to be compared 381 * @param task2 382 * the second task to be compared 383 * 384 * @return as described 385 * 386 * @throws IllegalStateException 387 * in the case, the {@link #init()} method was not called on the 388 * manager before a call to this method. 313 * 314 * @param task1 the first task to be compared 315 * @param task2 the second task to be compared 316 * @return as described 389 317 */ 390 318 public boolean areSyntacticallyEqual(ITask task1, ITask task2) { … … 410 338 * returns true, this method returns false. 411 339 * </p> 412 * 413 * @param instance1 414 * the first task instance to be compared 415 * @param instance2 416 * the second task instance to be compared 417 * 418 * @return as described 419 * 420 * @throws IllegalStateException 421 * in the case, the {@link #init()} method was not called on the 422 * manager before a call to this method. 340 * 341 * @param instance1 the first task instance to be compared 342 * @param instance2 the second task instance to be compared 343 * @return as described 423 344 */ 424 345 public boolean areSyntacticallyEqual(ITaskInstance instance1, -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskIdentityRule.java
r1733 r1734 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 24 25 * Else it returns null to denote, that it can not compare the tasks. 25 26 * </p> 26 * 27 * 28 * @author 2012, last modified by $Author: patrick$ 27 29 * @version $Revision: $ $Date: 19.02.2012$ 28 * @author 2012, last modified by $Author: patrick$29 30 */ 30 31 public class TaskIdentityRule implements TaskComparisonRule { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/ISessionScopeRule.java
r1733 r1734 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 20 20 21 // TODO: Auto-generated Javadoc 21 22 /** 22 23 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/ITaskInstanceScopeRule.java
r1733 r1734 17 17 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleApplicationResult.java
r1733 r1734 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 23 23 24 // TODO: Auto-generated Javadoc 24 25 /** 25 26 * <p> … … 35 36 class RuleApplicationResult implements Serializable { 36 37 37 /** 38 * 39 */ 38 /** The Constant serialVersionUID. */ 40 39 private static final long serialVersionUID = -5927099713841481328L; 41 40 42 /** */41 /** The status. */ 43 42 private RuleApplicationStatus status = RuleApplicationStatus.NOT_APPLIED; 44 43 45 /** */44 /** The new parent tasks. */ 46 45 private final List<ITask> newParentTasks = new ArrayList<ITask>(); 47 46 48 /** */47 /** The new parent instances. */ 49 48 private final List<ITaskInstance> newParentInstances = new ArrayList<ITaskInstance>(); 50 49 … … 53 52 * create a rule application result with a status 54 53 * {@link RuleApplicationStatus#RULE_NOT_APPLIED} 55 * </p> 54 * </p>. 56 55 */ 57 56 RuleApplicationResult() { … … 62 61 * <p> 63 62 * add a further parent task created during the rule application 64 * </p> 63 * </p>. 64 * 65 * @param newParent the new parent 65 66 */ 66 67 void addNewlyCreatedTask(ITask newParent) { … … 71 72 * <p> 72 73 * add a further parent task instance created during the rule application 73 * </p> 74 * </p>. 75 * 76 * @param newParent the new parent 74 77 */ 75 78 void addNewlyCreatedTaskInstance(ITaskInstance newParent) { … … 80 83 * <p> 81 84 * return all parent task instances created during the rule application 82 * </p> 85 * </p>. 86 * 87 * @return the newly created task instances 83 88 */ 84 89 List<ITaskInstance> getNewlyCreatedTaskInstances() { … … 89 94 * <p> 90 95 * return all parent tasks created during the rule application 91 * </p> 96 * </p>. 97 * 98 * @return the newly created tasks 92 99 */ 93 100 List<ITask> getNewlyCreatedTasks() { … … 98 105 * <p> 99 106 * return the rule application status 100 * </p> 107 * </p>. 108 * 109 * @return the rule application status 101 110 */ 102 111 RuleApplicationStatus getRuleApplicationStatus() { … … 107 116 * <p> 108 117 * set the rule application status 109 * </p> 118 * </p>. 119 * 120 * @param status the new rule application status 110 121 */ 111 122 void setRuleApplicationStatus(RuleApplicationStatus status) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleApplicationStatus.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 25 26 */ 26 27 enum RuleApplicationStatus { 27 FINISHED, NOT_APPLIED; 28 29 /** The finished. */ 30 FINISHED, 31 /** The not applied. */ 32 NOT_APPLIED; 28 33 } -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java
r1733 r1734 28 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 29 29 30 30 31 /** 31 32 * <p> 32 33 * provides some convenience methods for rule application 33 * </p> 34 * 34 * </p>. 35 * 35 36 * @author Patrick Harms 36 37 */ … … 41 42 * replaces a sub sequence for a specified range of elements in the provided 42 43 * task instances list by a sub task instance 43 * </p> 44 * 45 * @param parent 46 * the list of which the range shall be replaced 47 * @param startIndex 48 * the start index of the range 49 * @param endIndex 50 * the end index of the range (inclusive) 51 * @param model 52 * the task model (required for instantiating the sub sequence) 53 * @param taskFactory 54 * the task factory used for instantiating the sub sequence 55 * @param taskBuilder 56 * the task builder to perform changes in the task structure 57 * 44 * </p>. 45 * 46 * @param parent the list of which the range shall be replaced 47 * @param startIndex the start index of the range 48 * @param endIndex the end index of the range (inclusive) 49 * @param model the task model (required for instantiating the sub sequence) 50 * @param taskFactory the task factory used for instantiating the sub sequence 51 * @param taskBuilder the task builder to perform changes in the task structure 58 52 * @return the replacement for the range 59 * @throws60 53 */ 61 54 static ISequenceInstance createNewSubSequenceInRange( … … 65 58 .createNewTaskInstance(model); 66 59 67 // TODO: Debug output 68 /* 69 * System.out.println("PRINTING MODEL: "); for (int i = 0; i < 70 * subsequence.getSequence().getChildren().size(); i++) { 71 * System.out.println(subsequence.getSequence().getChildren().get(i)); 72 * 73 * if (subsequence.getSequence().getChildren().get(i).getType() == 74 * "selection") { for (int j = 0; j < ((ISelection) 75 * subsequence.getSequence().getChildren().get(i)) 76 * .getChildren().size(); j++) { if(((IStructuringTemporalRelationship) 77 * subsequence 78 * .getSequence().getChildren().get(i)).getChildren().get(j).getType() 79 * =="sequence") { ISequence foo = (ISequence) ((ISelection) 80 * (subsequence 81 * .getSequence().getChildren().get(i))).getChildren().get(j); 82 * System.out.println("\t" + foo); for(int k=0; k< 83 * foo.getChildren().size();k++) { System.out.println("\t\t" 84 * +foo.getChildren().get(k)); } System.out.println(); } else{ 85 * System.out.println("\t" + ((ISelection) 86 * subsequence.getSequence().getChildren().get(i)) 87 * .getChildren().get(j)); } 88 * 89 * } } 90 * 91 * } System.out.println(); 92 */ 93 94 // TODO: This is dirty! 60 61 // TODO: This is dirty, return this in addition with the sequence instance instead 95 62 missedOptionals = 0; 96 63 int modelindex = 0; … … 144 111 || (parent.get(startIndex).getTask().getId() == tmpSel 145 112 .getChildren().get(1).getId())) { 146 // System.out.println("Session ID: " +147 // parent.get(startIndex).getTask().getId() +148 // " tmpSel(0): " + tmpSel.getChildren().get(0).getId()149 // + " tmpSel(1): " +tmpSel.getChildren().get(1).getId()150 // );151 113 continue; 152 114 } … … 154 116 for (int k = 0; k < selseq.getSequence().getChildren() 155 117 .size(); k++) { 156 // System.out.println("Trying to add " +157 // parent.get(startIndex) + " to " + selseq);158 118 taskBuilder.addChild(selseq, parent.get(startIndex)); 159 119 taskBuilder.removeTaskInstance(parent, startIndex); 160 120 i++; 161 // System.out.println("I:" + i);162 121 } 163 // System.out.println("Trying to add " + selseq + " to " +164 // tmpSel);165 122 taskBuilder.setChild(selection, selseq); 166 123 taskBuilder.addChild(subsequence, selection); … … 168 125 continue; 169 126 } else { 170 // System.out.println("Trying to adding SelectionInstance "171 // + parent.get(startIndex) + " to " + tempTask);172 127 taskBuilder.setChild(selection, parent.get(startIndex)); 173 128 taskBuilder.addChild(subsequence, selection); 174 129 } 175 130 } else if (tempTask.getType() == "sequence") { 176 // System.out.println("Adding SequenceInstance " +177 // parent.get(startIndex) + " to " + tempTask);178 131 taskBuilder.addChild(subsequence, parent.get(startIndex)); 179 132 } else if (tempTask.getType() == "iteration") { 180 // System.out.println("Adding IterationInstance " +181 // parent.get(startIndex) + " to " + tempTask);182 133 taskBuilder.addChild(subsequence, parent.get(startIndex)); 183 134 } else { 184 // System.out.println("Adding EventInstance " +185 // parent.get(startIndex) + " to " + tempTask);186 // System.out.println("Foo");187 135 taskBuilder.addChild(subsequence, parent.get(startIndex)); 188 136 } … … 199 147 * <p> 200 148 * returns the next available id (uses the id counter) 201 * </p> 202 * 149 * </p>. 150 * 203 151 * @return the next available id 204 152 */ … … 241 189 } 242 190 243 // Print out the progress 191 /** 192 * Prints the progress percentage. 193 * 194 * @param message the message 195 * @param count the count 196 * @param size the size 197 */ 244 198 static void printProgressPercentage(String message, int count, int size) { 245 199 if (size > 100) { … … 270 224 private static int idCounter = 0; 271 225 226 /** The missed optionals. */ 272 227 public static int missedOptionals = 0; 273 228 … … 275 230 * <p> 276 231 * prevent instantiation 277 * </p> 232 * </p>. 278 233 */ 279 234 private RuleUtils() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java
r1733 r1734 43 43 import de.ugoe.cs.util.console.Console; 44 44 45 // TODO: Auto-generated Javadoc 45 46 /** 46 47 * <p> … … 66 67 67 68 /** 69 * The Class MaxCountAndLongestTasksFinder. 70 * 68 71 * @author Patrick Harms 69 72 */ … … 71 74 TrieProcessor<ITaskInstance> { 72 75 73 /** 74 * 75 */ 76 /** The current count. */ 76 77 private int currentCount; 77 78 78 /** 79 * 80 */ 79 /** The found tasks. */ 81 80 private final List<List<ITaskInstance>> foundTasks = new LinkedList<List<ITaskInstance>>(); 82 81 83 82 /** 84 * 83 * Instantiates a new max count and longest tasks finder. 85 84 */ 86 85 public MaxCountAndLongestTasksFinder() { … … 90 89 91 90 /** 92 * @return 91 * Gets the found tasks. 92 * 93 * @return the found tasks 93 94 */ 94 95 public Tasks getFoundTasks() { … … 158 159 159 160 /** 160 * 161 * Removes the permutations of shorter tasks. 161 162 */ 162 163 private void removePermutationsOfShorterTasks() { … … 189 190 190 191 /** 191 * 192 * The Class RuleApplicationData. 192 193 */ 193 194 private static class RuleApplicationData { 194 195 195 /** 196 * 197 */ 196 /** The sessions. */ 198 197 private final List<IUserSession> sessions; 199 198 200 /** 201 * 202 */ 199 /** The last trie. */ 203 200 private TaskInstanceTrie lastTrie; 204 201 205 /** 206 * default and minimum trained sequence length is 3 207 */ 202 /** default and minimum trained sequence length is 3. */ 208 203 private int trainedSequenceLength = 3; 209 204 210 /** 211 * 212 */ 205 /** The last found tasks. */ 213 206 private Tasks lastFoundTasks = new Tasks(Integer.MAX_VALUE, null); 214 207 215 /** 216 * 217 */ 208 /** The detected and replaced tasks. */ 218 209 private boolean detectedAndReplacedTasks; 219 210 220 /** 221 * 222 */ 211 /** The result. */ 223 212 private final RuleApplicationResult result = new RuleApplicationResult(); 224 213 225 /** 226 * 227 */ 214 /** The stop watch. */ 228 215 private final StopWatch stopWatch = new StopWatch(); 229 216 230 217 /** 231 * 218 * Instantiates a new rule application data. 219 * 220 * @param sessions the sessions 232 221 */ 233 222 private RuleApplicationData(List<IUserSession> sessions) { … … 236 225 237 226 /** 238 * 227 * Detected and replaced tasks. 228 * 229 * @return true, if successful 239 230 */ 240 231 private boolean detectedAndReplacedTasks() { … … 243 234 244 235 /** 245 * 236 * Detected and replaced tasks. 237 * 238 * @param detectedAndReplacedTasks the detected and replaced tasks 246 239 */ 247 240 private void detectedAndReplacedTasks(boolean detectedAndReplacedTasks) { … … 250 243 251 244 /** 245 * Gets the last found tasks. 246 * 252 247 * @return the lastFoundSequences 253 248 */ … … 257 252 258 253 /** 254 * Gets the last trie. 255 * 259 256 * @return the lastTrie 260 257 */ … … 264 261 265 262 /** 263 * Gets the result. 264 * 266 265 * @return the result 267 266 */ … … 271 270 272 271 /** 272 * Gets the sessions. 273 * 273 274 * @return the tree 274 275 */ … … 278 279 279 280 /** 281 * Gets the stop watch. 282 * 280 283 * @return the stopWatch 281 284 */ … … 285 288 286 289 /** 290 * Gets the trained sequence length. 291 * 287 292 * @return the trainedSequenceLength 288 293 */ … … 292 297 293 298 /** 294 * @param lastFoundSequences 295 * the lastFoundSequences to set 299 * Sets the last found tasks. 300 * 301 * @param lastFoundSequences the lastFoundSequences to set 296 302 */ 297 303 private void setLastFoundTasks(Tasks lastFoundSequences) { … … 300 306 301 307 /** 302 * @param lastTrie 303 * the lastTrie to set 308 * Sets the last trie. 309 * 310 * @param lastTrie the lastTrie to set 304 311 */ 305 312 private void setLastTrie(TaskInstanceTrie lastTrie) { … … 308 315 309 316 /** 310 * @param trainedSequenceLength 311 * the trainedSequenceLength to set 317 * Sets the trained sequence length. 318 * 319 * @param trainedSequenceLength the trainedSequenceLength to set 312 320 */ 313 321 private void setTrainedSequenceLength(int trainedSequenceLength) { … … 318 326 319 327 /** 328 * The Class Tasks. 329 * 320 330 * @author Patrick Harms 321 331 */ 322 332 private static class Tasks implements Iterable<List<ITaskInstance>> { 323 333 324 /** 325 * 326 */ 334 /** The occurrence count. */ 327 335 private final int occurrenceCount; 328 336 329 /** 330 * 331 */ 337 /** The sequences. */ 332 338 private final List<List<ITaskInstance>> sequences; 333 339 334 340 /** 335 * @param occurrenceCount 336 * @param sequences 341 * Instantiates a new tasks. 342 * 343 * @param occurrenceCount the occurrence count 344 * @param sequences the sequences 337 345 */ 338 346 private Tasks(int occurrenceCount, List<List<ITaskInstance>> sequences) { … … 343 351 344 352 /** 345 * @return 353 * Gets the occurrence count. 354 * 355 * @return the occurrence count 346 356 */ 347 357 private int getOccurrenceCount() { … … 364 374 365 375 /** 366 * @return 376 * Size. 377 * 378 * @return the int 367 379 */ 368 380 private int size() { … … 391 403 } 392 404 393 /** 394 * <p> 395 * the task factory to be used for creating substructures for the temporal 396 * relationships identified during rul application 397 * </p> 398 */ 405 /** <p> the task factory to be used for creating substructures for the temporal relationships identified during rul application </p>. */ 399 406 private final ITaskFactory taskFactory;; 400 407 401 /** 402 * <p> 403 * the task builder to be used for creating substructures for the temporal 404 * relationships identified during rule application 405 * </p> 406 */ 408 /** <p> the task builder to be used for creating substructures for the temporal relationships identified during rule application </p>. */ 407 409 private final ITaskBuilder taskBuilder; 408 410 … … 498 500 499 501 /** 500 * @param appData 501 * the rule application data combining all data used for applying 502 * Creates the new trie. 503 * 504 * @param appData the rule application data combining all data used for applying 502 505 * this rule 503 506 */ … … 554 557 555 558 /** 556 * TODO go on commenting 557 * 558 * @param appData 559 * the rule application data combining all data used for applying 559 * TODO go on commenting. 560 * 561 * @param appData the rule application data combining all data used for applying 560 562 * this rule 561 563 */ … … 578 580 579 581 /** 580 * @param appData 581 * the rule application data combining all data used for applying 582 * Gets the sequences occuring most often. 583 * 584 * @param appData the rule application data combining all data used for applying 582 585 * this rule 586 * @return the sequences occuring most often 583 587 */ 584 588 private void getSequencesOccuringMostOften(RuleApplicationData appData) { … … 668 672 669 673 /** 670 * @param trie 671 * @param object 672 * @return 674 * Gets the sub list index. 675 * 676 * @param list the list 677 * @param subList the sub list 678 * @param startIndex the start index 679 * @return the sub list index 673 680 */ 674 681 private int getSubListIndex(ITaskInstanceList list, … … 702 709 703 710 /** 704 * @param trie 705 * @param object 706 * @return 711 * Gets the sub list index. 712 * 713 * @param list the list 714 * @param subList the sub list 715 * @param startIndex the start index 716 * @return the sub list index 707 717 */ 708 718 private int getSubListIndex(List<ITaskInstance> list, … … 790 800 * <p> 791 801 * TODO clarify why this is done 792 * </p> 802 * </p>. 803 * 804 * @param iteration the iteration 805 * @param iterationInstances the iteration instances 793 806 */ 794 807 private void harmonizeIterationInstancesModel(IIteration iteration, … … 851 864 852 865 /** 853 * 866 * Harmonize sequence instances model. 867 * 868 * @param sequence the sequence 869 * @param sequenceInstances the sequence instances 870 * @param sequenceLength the sequence length 854 871 */ 855 872 private void harmonizeSequenceInstancesModel(ISequence sequence, … … 924 941 * <p> 925 942 * replaces all occurrences of all tasks provided in the set with iterations 926 * </p> 927 * 928 * @param iteratedTasks 929 * the tasks to be replaced with iterations 930 * @param sessions 931 * the sessions in which the tasks are to be replaced 932 * @param appData 933 * the rule application data combining all data used for applying 943 * </p>. 944 * 945 * @param iteratedTasks the tasks to be replaced with iterations 946 * @param sessions the sessions in which the tasks are to be replaced 947 * @param appData the rule application data combining all data used for applying 934 948 * this rule 935 949 */ … … 990 1004 991 1005 /** 992 * @param appData 993 * the rule application data combining all data used for applying 1006 * Replace sequences occurring most often. 1007 * 1008 * @param appData the rule application data combining all data used for applying 994 1009 * this rule 995 1010 */ … … 1032 1047 1033 1048 /** 1034 * @param tree 1049 * Replace task occurrences. 1050 * 1051 * @param task the task 1052 * @param sessions the sessions 1053 * @param temporalTaskModel the temporal task model 1054 * @return the list 1035 1055 */ 1036 1056 private List<ISequenceInstance> replaceTaskOccurrences( … … 1116 1136 * iterated, it is added to the returned set. 1117 1137 * </p> 1118 * 1119 * @param the 1120 * session to search for iterations in 1121 * 1138 * 1139 * @param sessions the sessions 1122 1140 * @return a set of tasks being iterated somewhere 1123 1141 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 16 16 17 import java.io.FileInputStream;18 import java.io.FileOutputStream;19 import java.io.IOException;20 import java.io.ObjectInputStream;21 import java.io.ObjectOutputStream;22 17 import java.io.Serializable; 23 18 import java.util.ArrayList; … … 36 31 import java.util.logging.Level; 37 32 38 import de.ugoe.cs.autoquest.CommandHelpers;39 33 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm; 40 34 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithmFactory; … … 59 53 import de.ugoe.cs.util.StopWatch; 60 54 import de.ugoe.cs.util.console.Console; 61 import de.ugoe.cs.util.console.GlobalDataContainer; 55 62 56 63 57 /** … … 66 60 * of recorded user sessions. For this, it first harmonizes all tasks. This 67 61 * eases later comparison. Then it searches the sessions for iterations and 68 * replaces them accordingly. Then it searches for sub sequences being the69 * longest and occurring most often.For each found sub sequence, it replaces62 * replaces them accordingly. Then it searches for sub sequences using alignment algorithms 63 * For each found sub sequence, it replaces 70 64 * the occurrences by creating appropriate {@link ISequence}s. Afterwards, again 71 65 * searches for iterations and then again for sub sequences until no more … … 75 69 * 76 70 * 77 * @author Patrick Harms71 * @author Ralph Krimmel 78 72 */ 79 73 public class SequenceForTaskDetectionRuleAlignment implements ISessionScopeRule { 80 74 75 76 /** 77 * The Class RuleApplicationData. 78 */ 79 private static class RuleApplicationData implements Serializable { 80 81 /** The Constant serialVersionUID. */ 82 private static final long serialVersionUID = -7559657686755522960L; 83 84 /** The number2task HashMap. Since we align the tasks just by their integer id, 85 * we need this to convert them back to Tasks again*/ 86 private final HashMap<Integer, ITask> number2task; 87 88 89 /** The unique tasks, keeps track about all unique tasks 90 * TODO: We Actually just need number2task here, this structure can be 91 * removed in the future.*/ 92 private final HashSet<ITask> uniqueTasks; 93 94 /** The substitution matrix used by the alignment algorithm to be able to compare 95 * distances of tasks */ 96 private final ObjectDistanceSubstitionMatrix submat; 97 98 /** HashMap for keeping track in which sequence which replacement has been performed. 99 * Neccessary for updating the indices of other occurrences accordingly */ 100 public HashMap<Integer, List<MatchOccurence>> replacedOccurences; 101 102 /** The list of all found matches */ 103 public LinkedList<Match> matchseqs; 104 105 /** The generated NumberSequences. 106 * This is the integer representation of the user sessions */ 107 private ArrayList<NumberSequence> numberseqs; 108 109 /** The list of newly created tasks (of one iteration). */ 110 private final LinkedList<ITask> newTasks; 111 112 /** The user sessions containing all EventTasks/Instances */ 113 private final List<IUserSession> sessions; 114 115 /** True if we replaced something in the user sessions in one iteration. */ 116 private boolean detectedAndReplacedTasks; 117 118 /** The result we give autoquest back */ 119 private final RuleApplicationResult result; 120 121 /** Stop Watch to measure performance */ 122 private final StopWatch stopWatch; 123 124 /** 125 * Instantiates a new rule application data. 126 * 127 * @param sessions The user sessions 128 */ 129 private RuleApplicationData(List<IUserSession> sessions) { 130 this.sessions = sessions; 131 numberseqs = new ArrayList<NumberSequence>(); 132 uniqueTasks = new HashSet<ITask>(); 133 number2task = new HashMap<Integer, ITask>(); 134 stopWatch = new StopWatch(); 135 result = new RuleApplicationResult(); 136 submat = new ObjectDistanceSubstitionMatrix(6, -3, false); 137 newTasks = new LinkedList<ITask>(); 138 this.detectedAndReplacedTasks = true; 139 } 140 141 /** 142 * Detected and replaced tasks. 143 * 144 * @return true, if successful 145 */ 146 private boolean detectedAndReplacedTasks() { 147 return detectedAndReplacedTasks; 148 } 149 150 /** 151 * Gets the matchseqs. 152 * 153 * @return the matchseqs 154 */ 155 public LinkedList<Match> getMatchseqs() { 156 return matchseqs; 157 } 158 159 /** 160 * Gets the new tasks. 161 * 162 * @return the new tasks 163 */ 164 public LinkedList<ITask> getNewTasks() { 165 return newTasks; 166 } 167 168 /** 169 * Gets the number2task. 170 * 171 * @return the number2task HashMap 172 */ 173 private HashMap<Integer, ITask> getNumber2Task() { 174 return number2task; 175 } 176 177 /** 178 * Gets the number sequences. 179 * 180 * @return the number sequences 181 */ 182 private ArrayList<NumberSequence> getNumberSequences() { 183 return numberseqs; 184 } 185 186 /** 187 * Gets the replaced occurrences. 188 * 189 * @return the replaced occurences 190 */ 191 public HashMap<Integer, List<MatchOccurence>> getReplacedOccurrences() { 192 return replacedOccurences; 193 } 194 195 /** 196 * Gets the result. 197 * 198 * @return the result 199 */ 200 private RuleApplicationResult getResult() { 201 return result; 202 } 203 204 /** 205 * Gets the sessions. 206 * 207 * @return the UserSessions as List. 208 */ 209 private List<IUserSession> getSessions() { 210 return sessions; 211 } 212 213 /** 214 * Gets the stop watch. 215 * 216 * @return the stopWatch 217 */ 218 private StopWatch getStopWatch() { 219 return stopWatch; 220 } 221 222 /** 223 * Gets the submat. 224 * 225 * @return the submat 226 */ 227 private ObjectDistanceSubstitionMatrix getSubmat() { 228 return submat; 229 } 230 231 /** 232 * Gets the unique tasks. 233 * 234 * @return the unique tasks 235 */ 236 private HashSet<ITask> getUniqueTasks() { 237 return uniqueTasks; 238 } 239 240 /** 241 * New task created. 242 * 243 * @param task the task 244 */ 245 private void newTaskCreated(ITask task) { 246 number2task.put(task.getId(), task); 247 newTasks.add(task); 248 } 249 250 /** 251 * Reset newly created tasks. 252 */ 253 synchronized private void resetNewlyCreatedTasks() { 254 uniqueTasks.addAll(newTasks); 255 newTasks.clear(); 256 } 257 258 /** 259 * Sets the number sequences. 260 * 261 * @param numberseqs the new number sequences 262 */ 263 private void setNumberSequences(ArrayList<NumberSequence> numberseqs) { 264 this.numberseqs = numberseqs; 265 } 266 267 /** 268 * Sets the replaced occurences. 269 * 270 * @param replacedOccurences the replaced occurences 271 */ 272 public void setReplacedOccurences( 273 HashMap<Integer, List<MatchOccurence>> replacedOccurences) { 274 this.replacedOccurences = replacedOccurences; 275 } 276 277 /** 278 * Update substitution matrix. 279 */ 280 private void updateSubstitutionMatrix() { 281 submat.update(getNewTasks()); 282 resetNewlyCreatedTasks(); 283 } 284 285 } 286 287 /** The n threads. */ 288 public static int nThreads = Runtime.getRuntime().availableProcessors() - 1; 289 290 /** The iteration. */ 291 private int iteration = 0; 292 293 /** <p> the task factory to be used for creating substructures for the temporal relationships identified during rul application </p>. */ 294 private final ITaskFactory taskFactory; 295 296 /** <p> the task builder to be used for creating substructures for the temporal relationships identified during rule application </p>. */ 297 private final ITaskBuilder taskBuilder; 298 299 /** 300 * <p> 301 * the task handling strategy to be used for comparing tasks for 302 * preparation, i.e., before the tasks are harmonized 303 * </p> 304 */ 305 private final TaskHandlingStrategy preparationTaskHandlingStrategy; 306 307 /** 308 * <p> 309 * instantiates the rule and initializes it with a task equality to be 310 * considered when comparing tasks as well as a task factory and builder to 311 * be used for creating task structures. 312 * </p> 313 * 314 * @param minimalTaskEquality 315 * the task equality to be considered when comparing tasks 316 * @param taskFactory 317 * the task factory to be used for creating substructures 318 * @param taskBuilder 319 * the task builder to be used for creating substructures 320 */ 321 322 SequenceForTaskDetectionRuleAlignment(TaskEquality minimalTaskEquality, 323 ITaskFactory taskFactory, ITaskBuilder taskBuilder) { 324 this.taskFactory = taskFactory; 325 this.taskBuilder = taskBuilder; 326 327 this.preparationTaskHandlingStrategy = new TaskHandlingStrategy( 328 minimalTaskEquality); 329 } 330 331 /* 332 * (non-Javadoc) 333 * 334 * @see 335 * de.ugoe.cs.autoquest.tasktrees.temporalrelation.ISessionScopeRule#apply 336 * (java.util.List) 337 */ 338 @Override 339 public RuleApplicationResult apply(List<IUserSession> sessions) { 340 final RuleApplicationData appData = new RuleApplicationData(sessions); 341 342 harmonizeEventTaskInstancesModel(appData); 343 344 345 Console.traceln(Level.INFO, "generating substitution matrix from " 346 + appData.getUniqueTasks().size() + " unique tasks"); 347 appData.getStopWatch().start("substitution matrix"); 348 appData.getSubmat().generate(appData.getUniqueTasks()); 349 appData.getStopWatch().stop("substitution matrix"); 350 351 Console.traceln(Level.INFO, "Starting main loop"); 352 do { 353 Console.traceln(Level.INFO, "Iteration Number: " + iteration); 354 iteration++; 355 appData.detectedAndReplacedTasks = false; 356 appData.getStopWatch().start("whole loop"); 357 detectAndReplaceIterations(appData); 358 appData.getStopWatch().start("task replacement"); 359 appData.updateSubstitutionMatrix(); 360 detectAndReplaceTasks(appData); // 361 appData.getStopWatch().stop("task replacement"); 362 appData.getStopWatch().stop("whole loop"); 363 appData.getStopWatch().dumpStatistics(System.out); 364 appData.getStopWatch().reset(); 365 366 } while (appData.detectedAndReplacedTasks()); 367 368 Console.println("created " 369 + appData.getResult().getNewlyCreatedTasks().size() 370 + " new tasks and " 371 + appData.getResult().getNewlyCreatedTaskInstances().size() 372 + " appropriate instances\n"); 373 374 if ((appData.getResult().getNewlyCreatedTasks().size() > 0) 375 || (appData.getResult().getNewlyCreatedTaskInstances().size() > 0)) { 376 appData.getResult().setRuleApplicationStatus( 377 RuleApplicationStatus.FINISHED); 378 } 379 380 return appData.getResult(); 381 } 382 383 /** 384 * Creates the number sequences. 385 * 386 * @param appData the app data 387 * @return the array list 388 */ 389 private ArrayList<NumberSequence> createNumberSequences( 390 RuleApplicationData appData) { 391 final ArrayList<NumberSequence> result = new ArrayList<NumberSequence>(); 392 for (int i = 0; i < appData.getSessions().size(); i++) { 393 final IUserSession session = appData.getSessions().get(i); 394 final NumberSequence templist = new NumberSequence(session.size()); 395 for (int j = 0; j < session.size(); j++) { 396 final ITaskInstance taskInstance = session.get(j); 397 templist.getSequence()[j] = taskInstance.getTask().getId(); 398 } 399 // Each NumberSequence is identified by its id, beginning to count 400 // at zero 401 templist.setId(i); 402 result.add(templist); 403 } 404 return result; 405 } 406 407 /** 408 * <p> 409 * searches for direct iterations of single tasks in all sequences and 410 * replaces them with {@link IIteration}s, respectively appropriate 411 * instances. Also all single occurrences of a task that is iterated 412 * somewhen are replaced with iterations to have again an efficient way for 413 * task comparisons. 414 * </p> 415 * 416 * @param appData 417 * the rule application data combining all data used for applying 418 * this rule 419 */ 420 private void detectAndReplaceIterations(RuleApplicationData appData) { 421 Console.traceln(Level.FINE, "detecting iterations"); 422 appData.getStopWatch().start("detecting iterations"); 423 424 final List<IUserSession> sessions = appData.getSessions(); 425 426 final Set<ITask> iteratedTasks = searchIteratedTasks(sessions); 427 428 if (iteratedTasks.size() > 0) { 429 replaceIterationsOf(iteratedTasks, sessions, appData); 430 } 431 432 appData.getStopWatch().stop("detecting iterations"); 433 Console.traceln(Level.INFO, "replaced " + iteratedTasks.size() 434 + " iterated tasks"); 435 } 436 437 /** 438 * Detect and replace tasks. 439 * 440 * @param appData the rule application data combining all data used for applying 441 * this rule 442 */ 443 private void detectAndReplaceTasks(RuleApplicationData appData) { 444 Console.traceln(Level.FINE, "detecting and replacing tasks"); 445 appData.getStopWatch().start("detecting tasks"); 446 447 // Create NumberSequences 448 appData.setNumberSequences(this.createNumberSequences(appData)); 449 450 // Generate pairwise alignments 451 // appData.setMatchseqs(generatePairwiseAlignments(appData)); 452 generatePairwiseAlignments(appData); 453 454 // Searching each match in all other sessions, counting its occurences 455 searchMatchesInAllSessions(appData); 456 457 // Sort results to get the most occurring results 458 Console.traceln(Level.INFO, "sorting " + appData.getMatchseqs().size() 459 + " results"); 460 final Comparator<Match> comparator = new Comparator<Match>() { 461 @Override 462 public int compare(Match m1, Match m2) { 463 return m2.occurenceCount() - m1.occurenceCount(); 464 465 } 466 }; 467 Collections.sort(appData.getMatchseqs(), comparator); 468 appData.getStopWatch().stop("detecting tasks"); 469 470 // Replace matches in the sessions 471 Console.traceln(Level.INFO, "Replacing matches in sessions"); 472 appData.getStopWatch().start("replacing tasks"); 473 replaceMatches(appData); 474 appData.getStopWatch().stop("replacing tasks"); 475 } 476 477 478 /** 479 * Generate pairwise alignments. 480 * 481 * @param appData the app data 482 */ 483 private void generatePairwiseAlignments(RuleApplicationData appData) { 484 final int numberSeqSize = appData.getNumberSequences().size(); 485 appData.matchseqs = new LinkedList<Match>(); 486 Console.traceln(Level.INFO, "generating pairwise alignments from " 487 + numberSeqSize + " sessions with " + nThreads + " threads"); 488 489 int newThreads = nThreads; 490 if (numberSeqSize < nThreads) { 491 newThreads = numberSeqSize; 492 } 493 494 final ExecutorService executor = Executors 495 .newFixedThreadPool(newThreads); 496 final int interval = numberSeqSize / newThreads; 497 int rest = numberSeqSize % newThreads; 498 499 for (int i = 0; i < (numberSeqSize - interval); i += interval) { 500 int offset = 0; 501 if (rest != 0) { 502 offset = 1; 503 rest--; 504 } 505 final int from = i; 506 final int to = i + interval + offset; 507 System.out.println("Creating thread for sessions " + from 508 + " till " + to); 509 final ParallelPairwiseAligner aligner = new ParallelPairwiseAligner( 510 appData, from, to); 511 executor.execute(aligner); 512 } 513 executor.shutdown(); 514 try { 515 executor.awaitTermination(2, TimeUnit.HOURS); 516 } catch (final InterruptedException e) { 517 // TODO Auto-generated catch block 518 e.printStackTrace(); 519 } 520 } 521 522 /** 523 * <p> 524 * harmonizes the event task instances by unifying tasks. This is done, as 525 * initially the event tasks being equal with respect to the considered task 526 * equality are distinct objects. The comparison of these distinct objects 527 * is more time consuming than comparing the object references. 528 * </p> 529 * 530 * @param appData 531 * the rule application data combining all data used for applying 532 * this rule 533 * @return Returns the unique tasks symbol map 534 */ 535 private void harmonizeEventTaskInstancesModel(RuleApplicationData appData) { 536 Console.traceln(Level.INFO, 537 "harmonizing task model of event task instances"); 538 appData.getStopWatch().start("harmonizing event tasks"); 539 final SymbolMap<ITaskInstance, ITask> uniqueTasks = preparationTaskHandlingStrategy 540 .createSymbolMap(); 541 542 final TaskInstanceComparator comparator = preparationTaskHandlingStrategy 543 .getTaskComparator(); 544 545 int unifiedTasks = 0; 546 ITask task; 547 final List<IUserSession> sessions = appData.getSessions(); 548 for (int j = 0; j < sessions.size(); j++) { 549 final IUserSession session = sessions.get(j); 550 551 for (int i = 0; i < session.size(); i++) { 552 final ITaskInstance taskInstance = session.get(i); 553 task = uniqueTasks.getValue(taskInstance); 554 555 if (task == null) { 556 uniqueTasks.addSymbol(taskInstance, taskInstance.getTask()); 557 appData.getUniqueTasks().add(taskInstance.getTask()); 558 appData.getNumber2Task().put( 559 taskInstance.getTask().getId(), 560 taskInstance.getTask()); 561 } else { 562 taskBuilder.setTask(taskInstance, task); 563 unifiedTasks++; 564 } 565 } 566 comparator.clearBuffers(); 567 } 568 569 appData.getStopWatch().stop("harmonizing event tasks"); 570 Console.traceln(Level.INFO, "harmonized " + unifiedTasks 571 + " task occurrences (still " + appData.getUniqueTasks().size() 572 + " different tasks)"); 573 574 appData.getStopWatch().dumpStatistics(System.out); 575 appData.getStopWatch().reset(); 576 } 577 578 /** 579 * <p> 580 * TODO clarify why this is done 581 * </p>. 582 * 583 * @param iteration the iteration 584 * @param iterationInstances the iteration instances 585 */ 586 private void harmonizeIterationInstancesModel(IIteration iteration, 587 List<IIterationInstance> iterationInstances) { 588 final List<ITask> iteratedTaskVariants = new LinkedList<ITask>(); 589 final TaskInstanceComparator comparator = preparationTaskHandlingStrategy 590 .getTaskComparator(); 591 592 // merge the lexically different variants of iterated task to a unique 593 // list 594 for (final IIterationInstance iterationInstance : iterationInstances) { 595 for (final ITaskInstance executionVariant : iterationInstance) { 596 final ITask candidate = executionVariant.getTask(); 597 598 boolean found = false; 599 for (final ITask taskVariant : iteratedTaskVariants) { 600 if (comparator.areLexicallyEqual(taskVariant, candidate)) { 601 taskBuilder.setTask(executionVariant, taskVariant); 602 found = true; 603 break; 604 } 605 } 606 607 if (!found) { 608 iteratedTaskVariants.add(candidate); 609 } 610 } 611 } 612 613 // if there are more than one lexically different variant of iterated 614 // tasks, adapt the 615 // iteration model to be a selection of different variants. In this case 616 // also adapt 617 // the generated iteration instances to correctly contain selection 618 // instances. If there 619 // is only one variant of an iterated task, simply set this as the 620 // marked task of the 621 // iteration. In this case, the instances can be preserved as is 622 if (iteratedTaskVariants.size() > 1) { 623 final ISelection selection = taskFactory.createNewSelection(); 624 625 for (final ITask variant : iteratedTaskVariants) { 626 taskBuilder.addChild(selection, variant); 627 } 628 629 taskBuilder.setMarkedTask(iteration, selection); 630 631 for (final IIterationInstance instance : iterationInstances) { 632 for (int i = 0; i < instance.size(); i++) { 633 final ISelectionInstance selectionInstance = taskFactory 634 .createNewTaskInstance(selection); 635 taskBuilder.setChild(selectionInstance, instance.get(i)); 636 taskBuilder.setTaskInstance(instance, i, selectionInstance); 637 } 638 } 639 } else { 640 taskBuilder.setMarkedTask(iteration, iteratedTaskVariants.get(0)); 641 } 642 } 643 644 645 /** 646 * Match as sequence. 647 * 648 * @param appData , Ruleapplication Data needed to keep track of all created 649 * tasks 650 * @param m The match to be converted into a Task 651 * @return The task of the match with an ISequence as it's root 652 */ 653 synchronized public ISequence matchAsSequence(RuleApplicationData appData, 654 Match m) { 655 final ISequence sequence = taskFactory.createNewSequence(); 656 appData.newTaskCreated(sequence); 657 658 final int[] first = m.getFirstSequence().getSequence(); 659 final int[] second = m.getSecondSequence().getSequence(); 660 661 // Both sequences of a match are equally long 662 for (int i = 0; i < m.getFirstSequence().size(); i++) { 663 664 // Two gaps aligned to each other: Have not seen it happening so 665 // far, just to handle it 666 if ((first[i] == -1) && (second[i] == -1)) { 667 // Do nothing here. 668 } 669 // Both events are equal, we can simply add the task referring to 670 // the number 671 else if (first[i] == second[i]) { 672 taskBuilder.addChild(sequence, 673 appData.getNumber2Task().get(first[i])); 674 } 675 // We have a gap in the first sequence, we need to add the task of 676 // the second sequence as optional 677 else if ((first[i] == -1) && (second[i] != -1)) { 678 final IOptional optional = taskFactory.createNewOptional(); 679 appData.newTaskCreated(optional); 680 taskBuilder.setMarkedTask(optional, appData.getNumber2Task() 681 .get(second[i])); 682 taskBuilder.addChild(sequence, optional); 683 } 684 // We have a gap in the second sequence, we need to add the task of 685 // the first sequence as optional 686 else if ((first[i] != -1) && (second[i] == -1)) { 687 final IOptional optional = taskFactory.createNewOptional(); 688 appData.newTaskCreated(optional); 689 taskBuilder.setMarkedTask(optional, appData.getNumber2Task() 690 .get(first[i])); 691 taskBuilder.addChild(sequence, optional); 692 } 693 // Both tasks are not equal, we need to insert a selection here. 694 // Check if the next position is not a selection 695 else if (i < (first.length - 1)) { 696 697 if ((first[i] != second[i]) 698 && (((first[i + 1] == second[i + 1]) 699 || (first[i + 1] == -1) || (second[i + 1] == -1)))) { 700 701 final ISelection selection = taskFactory 702 .createNewSelection(); 703 appData.newTaskCreated(selection); 704 taskBuilder.addChild(selection, appData.getNumber2Task() 705 .get(first[i])); 706 taskBuilder.addChild(selection, appData.getNumber2Task() 707 .get(second[i])); 708 taskBuilder.addChild(sequence, selection); 709 } else { 710 boolean selectionfound = true; 711 final ISelection selection = taskFactory 712 .createNewSelection(); 713 appData.newTaskCreated(selection); 714 715 final ISequence subsequence1 = taskFactory 716 .createNewSequence(); 717 appData.newTaskCreated(subsequence1); 718 719 final ISequence subsequence2 = taskFactory 720 .createNewSequence(); 721 appData.newTaskCreated(subsequence2); 722 723 taskBuilder.addChild(selection, subsequence1); 724 taskBuilder.addChild(selection, subsequence2); 725 taskBuilder.addChild(sequence, selection); 726 while ((i < (first.length - 1)) && selectionfound) { 727 selectionfound = false; 728 taskBuilder.addChild(subsequence1, appData 729 .getNumber2Task().get(first[i])); 730 taskBuilder.addChild(subsequence2, appData 731 .getNumber2Task().get(second[i])); 732 if ((first[i + 1] != second[i + 1]) 733 && (first[i + 1] != -1) 734 && (second[i + 1] != -1)) { 735 selectionfound = true; 736 } else { 737 continue; 738 } 739 i++; 740 } 741 if ((i == (first.length - 1)) && selectionfound) { 742 taskBuilder.addChild(subsequence1, appData 743 .getNumber2Task().get(first[i])); 744 taskBuilder.addChild(subsequence2, appData 745 .getNumber2Task().get(second[i])); 746 } 747 } 748 } else { 749 if ((first[i] != second[i])) { 750 751 final ISelection selection = taskFactory 752 .createNewSelection(); 753 appData.newTaskCreated(selection); 754 taskBuilder.addChild(selection, appData.getNumber2Task() 755 .get(first[i])); 756 taskBuilder.addChild(selection, appData.getNumber2Task() 757 .get(second[i])); 758 taskBuilder.addChild(sequence, selection); 759 } 760 } 761 762 } 763 return sequence; 764 } 765 766 /** 767 * <p> 768 * replaces all occurrences of all tasks provided in the set with iterations 769 * </p>. 770 * 771 * @param iteratedTasks the tasks to be replaced with iterations 772 * @param sessions the sessions in which the tasks are to be replaced 773 * @param appData the rule application data combining all data used for applying 774 * this rule 775 */ 776 private void replaceIterationsOf(Set<ITask> iteratedTasks, 777 List<IUserSession> sessions, RuleApplicationData appData) { 778 final Map<ITask, IIteration> iterations = new HashMap<ITask, IIteration>(); 779 final Map<IIteration, List<IIterationInstance>> iterationInstances = new HashMap<IIteration, List<IIterationInstance>>(); 780 781 for (final ITask iteratedTask : iteratedTasks) { 782 783 final IIteration iteration = taskFactory.createNewIteration(); 784 appData.newTaskCreated(iteration); 785 iterations.put(iteratedTask, iteration); 786 iterationInstances.put(iteration, 787 new LinkedList<IIterationInstance>()); 788 } 789 790 IIterationInstance iterationInstance; 791 792 for (final IUserSession session : sessions) { 793 int index = 0; 794 iterationInstance = null; 795 796 while (index < session.size()) { 797 // we prepared the task instances to refer to unique tasks, if 798 // they are treated 799 // as equal. Therefore, we just compare the identity of the 800 // tasks of the task 801 // instances 802 final ITask currentTask = session.get(index).getTask(); 803 final IIteration iteration = iterations.get(currentTask); 804 if (iteration != null) { 805 if ((iterationInstance == null) 806 || (iterationInstance.getTask() != iteration)) { 807 iterationInstance = taskFactory 808 .createNewTaskInstance(iteration); 809 iterationInstances.get(iteration) 810 .add(iterationInstance);// TODO:: Don't create 811 // TaskInstances here, 812 // use a set of tasks 813 // instead 814 taskBuilder.addTaskInstance(session, index, 815 iterationInstance); 816 index++; 817 } 818 819 taskBuilder.addChild(iterationInstance, session.get(index)); 820 taskBuilder.removeTaskInstance(session, index); 821 } else { 822 if (iterationInstance != null) { 823 iterationInstance = null; 824 } 825 index++; 826 } 827 } 828 } 829 830 for (final Map.Entry<IIteration, List<IIterationInstance>> entry : iterationInstances 831 .entrySet()) { 832 harmonizeIterationInstancesModel(entry.getKey(), entry.getValue()); 833 } 834 } 835 836 /** 837 * Replace matches. 838 * 839 * @param appData the app data 840 */ 841 private void replaceMatches(RuleApplicationData appData) { 842 appData.replacedOccurences = new HashMap<Integer, List<MatchOccurence>>(); 843 844 final int matchSeqSize = appData.getMatchseqs().size(); 845 int newThreads = nThreads; 846 if (matchSeqSize < nThreads) { 847 newThreads = matchSeqSize; 848 } 849 final ExecutorService executor = Executors 850 .newFixedThreadPool(newThreads); 851 final int interval = matchSeqSize / newThreads; 852 int rest = matchSeqSize % newThreads; 853 854 for (int i = 0; i < (matchSeqSize - interval); i += interval) { 855 int offset = 0; 856 if (rest != 0) { 857 offset = 1; 858 rest--; 859 } 860 final int from = i; 861 final int to = i + interval + offset; 862 System.out 863 .println("Replacement: Creating thread with matches from " 864 + from + " to " + to); 865 // search each match in every other sequence 866 final ParallelMatchReplacer replacer = new ParallelMatchReplacer( 867 appData, from, to); 868 executor.execute(replacer); 869 } 870 executor.shutdown(); 871 try { 872 executor.awaitTermination(2, TimeUnit.HOURS); 873 } catch (final InterruptedException e) { 874 // TODO Auto-generated catch block 875 e.printStackTrace(); 876 } 877 } 878 879 880 /** 881 * <p> 882 * searches the provided sessions for task iterations. If a task is 883 * iterated, it is added to the returned set. 884 * </p> 885 * 886 * @param sessions the sessions 887 * @return a set of tasks being iterated somewhere 888 */ 889 private Set<ITask> searchIteratedTasks(List<IUserSession> sessions) { 890 final Set<ITask> iteratedTasks = new HashSet<ITask>(); 891 for (final IUserSession session : sessions) { 892 for (int i = 0; i < (session.size() - 1); i++) { 893 // we prepared the task instances to refer to unique tasks, if 894 // they are treated 895 // as equal. Therefore, we just compare the identity of the 896 // tasks of the task 897 // instances 898 if (session.get(i).getTask() == session.get(i + 1).getTask()) { 899 iteratedTasks.add(session.get(i).getTask()); 900 } 901 } 902 } 903 return iteratedTasks; 904 } 905 906 /** 907 * Search matches in all sessions. 908 * 909 * @param appData the app data 910 */ 911 private void searchMatchesInAllSessions(RuleApplicationData appData) { 912 Console.traceln(Level.INFO, 913 "searching for patterns occuring most with " + nThreads 914 + " threads"); 915 // Prepare parallel search of matchseqs 916 917 final int matchSeqSize = appData.getMatchseqs().size(); 918 int newThreads = nThreads; 919 if (matchSeqSize < nThreads) { 920 newThreads = matchSeqSize; 921 } 922 final int interval = matchSeqSize / newThreads; 923 int rest = matchSeqSize % newThreads; 924 final ExecutorService executor = Executors.newFixedThreadPool(nThreads); 925 926 for (int i = 0; i < (matchSeqSize - interval); i += interval) { 927 int offset = 0; 928 if (rest != 0) { 929 offset = 1; 930 rest--; 931 } 932 final int from = i; 933 final int to = i + interval + offset; 934 System.out 935 .println("Match finding: Creating thread with matches from " 936 + from + " to " + to); 937 // search each match in every other sequence 938 final ParallelMatchOcurrencesFinder finder = new ParallelMatchOcurrencesFinder( 939 appData, from, to); 940 executor.execute(finder); 941 } 942 executor.shutdown(); 943 try { 944 executor.awaitTermination(2, TimeUnit.HOURS); 945 } catch (final InterruptedException e) { 946 // TODO Auto-generated catch block 947 e.printStackTrace(); 948 } 949 950 } 951 952 /* 953 * (non-Javadoc) 954 * 955 * @see java.lang.Object#toString() 956 */ 957 @Override 958 public String toString() { 959 return "SequenceForTaskDetectionRuleAlignment"; 960 } 961 962 /** 963 * The Class ParallelMatchOcurrencesFinder. 964 */ 81 965 private class ParallelMatchOcurrencesFinder implements Runnable { 966 967 /** The app data. */ 82 968 private final RuleApplicationData appData; 969 970 /** The from. */ 83 971 private final int from; 972 973 /** The to. */ 84 974 private final int to; 85 975 976 /** 977 * Instantiates a new parallel match ocurrences finder. 978 * 979 * @param appData the app data 980 * @param from the from 981 * @param to the to 982 */ 86 983 ParallelMatchOcurrencesFinder(RuleApplicationData appData, int from, 87 984 int to) { … … 91 988 } 92 989 990 /* (non-Javadoc) 991 * @see java.lang.Runnable#run() 992 */ 93 993 @Override 94 994 public void run() { … … 129 1029 } 130 1030 1031 /** 1032 * The Class ParallelMatchReplacer. 1033 */ 131 1034 private class ParallelMatchReplacer implements Runnable { 132 1035 1036 /** The app data. */ 133 1037 private final RuleApplicationData appData; 1038 1039 /** The from. */ 134 1040 private final int from; 1041 1042 /** The to. */ 135 1043 private final int to; 136 1044 1045 /** 1046 * Instantiates a new parallel match replacer. 1047 * 1048 * @param appData the app data 1049 * @param from the from 1050 * @param to the to 1051 */ 137 1052 ParallelMatchReplacer(RuleApplicationData appData, int from, int to) { 138 1053 this.appData = appData; … … 141 1056 } 142 1057 1058 /* (non-Javadoc) 1059 * @see java.lang.Runnable#run() 1060 */ 143 1061 @Override 144 1062 public void run() { … … 164 1082 // want to replace now 165 1083 166 synchronized (appData.getReplacedOccur ences()) {167 if (appData.getReplacedOccur ences().get(1084 synchronized (appData.getReplacedOccurrences()) { 1085 if (appData.getReplacedOccurrences().get( 168 1086 oc.getSequenceId()) == null) { 169 appData.getReplacedOccur ences().put(1087 appData.getReplacedOccurrences().put( 170 1088 oc.getSequenceId(), 171 1089 new LinkedList<MatchOccurence>()); … … 186 1104 // harmonized. 187 1105 for (final Iterator<MatchOccurence> jt = appData 188 .getReplacedOccur ences()1106 .getReplacedOccurrences() 189 1107 .get(oc.getSequenceId()).iterator(); jt 190 1108 .hasNext();) { … … 239 1157 // instance. (OptionalInstances may be shorter) 240 1158 241 synchronized (appData.getReplacedOccur ences().get(1159 synchronized (appData.getReplacedOccurrences().get( 242 1160 oc.getSequenceId())) { 243 appData.getReplacedOccur ences()1161 appData.getReplacedOccurrences() 244 1162 .get(oc.getSequenceId()).add(oc); 245 1163 } … … 250 1168 } 251 1169 1170 /** 1171 * The Class ParallelPairwiseAligner. 1172 */ 252 1173 private class ParallelPairwiseAligner implements Runnable { 1174 1175 /** The app data. */ 253 1176 private final RuleApplicationData appData; 1177 1178 /** The from. */ 254 1179 private final int from; 1180 1181 /** The to. */ 255 1182 private final int to; 256 1183 1184 /** 1185 * Instantiates a new parallel pairwise aligner. 1186 * 1187 * @param appData the app data 1188 * @param from the from 1189 * @param to the to 1190 */ 257 1191 ParallelPairwiseAligner(RuleApplicationData appData, int from, int to) { 258 1192 this.appData = appData; … … 261 1195 } 262 1196 1197 /* (non-Javadoc) 1198 * @see java.lang.Runnable#run() 1199 */ 263 1200 @Override 264 1201 public void run() { … … 286 1223 } 287 1224 } 288 289 /** 290 * 291 */ 292 private static class RuleApplicationData implements Serializable { 293 294 /** 295 * 296 */ 297 private static final long serialVersionUID = -7559657686755522960L; 298 299 private final HashMap<Integer, ITask> number2task; 300 301 // TODO: We Actually just need number2task here, this structure can be 302 // removed in the future. 303 private final HashSet<ITask> uniqueTasks; 304 305 private final ObjectDistanceSubstitionMatrix submat; 306 307 public HashMap<Integer, List<MatchOccurence>> replacedOccurences; 308 309 public LinkedList<Match> matchseqs; 310 311 private ArrayList<NumberSequence> numberseqs; 312 313 private final LinkedList<ITask> newTasks; 314 315 /** 316 * 317 */ 318 private final List<IUserSession> sessions; 319 320 /** 321 * 322 */ 323 private boolean detectedAndReplacedTasks; 324 325 /** 326 * 327 */ 328 private final RuleApplicationResult result; 329 330 /** 331 * 332 */ 333 private final StopWatch stopWatch; 334 335 /** 336 * 337 */ 338 private RuleApplicationData(List<IUserSession> sessions) { 339 this.sessions = sessions; 340 numberseqs = new ArrayList<NumberSequence>(); 341 uniqueTasks = new HashSet<ITask>(); 342 number2task = new HashMap<Integer, ITask>(); 343 stopWatch = new StopWatch(); 344 result = new RuleApplicationResult(); 345 submat = new ObjectDistanceSubstitionMatrix(6, -3, false); 346 newTasks = new LinkedList<ITask>(); 347 this.detectedAndReplacedTasks = true; 348 } 349 350 /** 351 * 352 */ 353 private boolean detectedAndReplacedTasks() { 354 return detectedAndReplacedTasks; 355 } 356 357 public LinkedList<Match> getMatchseqs() { 358 return matchseqs; 359 } 360 361 public LinkedList<ITask> getNewTasks() { 362 return newTasks; 363 } 364 365 private HashMap<Integer, ITask> getNumber2Task() { 366 return number2task; 367 } 368 369 private ArrayList<NumberSequence> getNumberSequences() { 370 return numberseqs; 371 } 372 373 public HashMap<Integer, List<MatchOccurence>> getReplacedOccurences() { 374 return replacedOccurences; 375 } 376 377 /** 378 * @return the result 379 */ 380 private RuleApplicationResult getResult() { 381 return result; 382 } 383 384 /** 385 * @return the UserSessions as List. 386 */ 387 private List<IUserSession> getSessions() { 388 return sessions; 389 } 390 391 /** 392 * @return the stopWatch 393 */ 394 private StopWatch getStopWatch() { 395 return stopWatch; 396 } 397 398 private ObjectDistanceSubstitionMatrix getSubmat() { 399 return submat; 400 } 401 402 private HashSet<ITask> getUniqueTasks() { 403 return uniqueTasks; 404 } 405 406 private void newTaskCreated(ITask task) { 407 number2task.put(task.getId(), task); 408 newTasks.add(task); 409 } 410 411 synchronized private void resetNewlyCreatedTasks() { 412 uniqueTasks.addAll(newTasks); 413 newTasks.clear(); 414 } 415 416 private void setNumberSequences(ArrayList<NumberSequence> numberseqs) { 417 this.numberseqs = numberseqs; 418 } 419 420 public void setReplacedOccurences( 421 HashMap<Integer, List<MatchOccurence>> replacedOccurences) { 422 this.replacedOccurences = replacedOccurences; 423 } 424 425 private void updateSubstitutionMatrix() { 426 submat.update(getNewTasks()); 427 resetNewlyCreatedTasks(); 428 } 429 430 } 431 432 public static int nThreads = Runtime.getRuntime().availableProcessors() - 1; 433 434 private int iteration = 0; 435 436 /** 437 * <p> 438 * the task factory to be used for creating substructures for the temporal 439 * relationships identified during rul application 440 * </p> 441 */ 442 private final ITaskFactory taskFactory; 443 444 /** 445 * <p> 446 * the task builder to be used for creating substructures for the temporal 447 * relationships identified during rule application 448 * </p> 449 */ 450 private final ITaskBuilder taskBuilder; 451 452 /** 453 * <p> 454 * the task handling strategy to be used for comparing tasks for 455 * preparation, i.e., before the tasks are harmonized 456 * </p> 457 */ 458 private final TaskHandlingStrategy preparationTaskHandlingStrategy; 459 460 /** 461 * <p> 462 * instantiates the rule and initializes it with a task equality to be 463 * considered when comparing tasks as well as a task factory and builder to 464 * be used for creating task structures. 465 * </p> 466 * 467 * @param minimalTaskEquality 468 * the task equality to be considered when comparing tasks 469 * @param taskFactory 470 * the task factory to be used for creating substructures 471 * @param taskBuilder 472 * the task builder to be used for creating substructures 473 */ 474 475 SequenceForTaskDetectionRuleAlignment(TaskEquality minimalTaskEquality, 476 ITaskFactory taskFactory, ITaskBuilder taskBuilder) { 477 this.taskFactory = taskFactory; 478 this.taskBuilder = taskBuilder; 479 480 this.preparationTaskHandlingStrategy = new TaskHandlingStrategy( 481 minimalTaskEquality); 482 } 483 484 /* 485 * (non-Javadoc) 486 * 487 * @see 488 * de.ugoe.cs.autoquest.tasktrees.temporalrelation.ISessionScopeRule#apply 489 * (java.util.List) 490 */ 491 @Override 492 public RuleApplicationResult apply(List<IUserSession> sessions) { 493 final RuleApplicationData appData = new RuleApplicationData(sessions); 494 // File harmonized = new File("harmonized.dat"); 495 // if(harmonized.exists() && !harmonized.isDirectory()) { 496 // Console.traceln(Level.INFO,"loading harmonized sessions from file"); 497 // appData = loadAppData("harmonized"); 498 // } 499 // else { 500 // appData.getStopWatch().start("harmonization"); 501 harmonizeEventTaskInstancesModel(appData); 502 // appData.getStopWatch().stop("harmonization"); 503 GlobalDataContainer.getInstance().addData("harmonized", appData); 504 // Saving intermediate results to file 505 Console.traceln(Level.INFO, "saving substitution matrix to file"); 506 // saveAppData("harmonized"); 507 // } 508 509 // File substitution = new File("substitution.dat"); 510 // if(!(substitution.exists() && !substitution.isDirectory())) { 511 Console.traceln(Level.INFO, "generating substitution matrix from " 512 + appData.getUniqueTasks().size() + " unique tasks"); 513 appData.getStopWatch().start("substitution matrix"); 514 appData.getSubmat().generate(appData.getUniqueTasks()); 515 appData.getStopWatch().stop("substitution matrix"); 516 // GlobalDataContainer.getInstance().addData("substitution", appData); 517 // saveAppData("substitution"); 518 // } 519 // else { 520 // Console.traceln(Level.INFO,"loading substitution matrix from file"); 521 // appData = loadAppData("substitution"); 522 // } 523 524 Console.traceln(Level.INFO, "Starting main loop"); 525 do { 526 Console.traceln(Level.INFO, "Iteration Number: " + iteration); 527 iteration++; 528 appData.detectedAndReplacedTasks = false; 529 appData.getStopWatch().start("whole loop"); 530 detectAndReplaceIterations(appData); 531 appData.getStopWatch().start("task replacement"); 532 // appData.updateSubstitutionMatrix(); 533 detectAndReplaceTasks(appData); // 534 appData.getStopWatch().stop("task replacement"); 535 appData.getStopWatch().stop("whole loop"); 536 appData.getStopWatch().dumpStatistics(System.out); 537 appData.getStopWatch().reset(); 538 539 } while (appData.detectedAndReplacedTasks()); 540 541 Console.println("created " 542 + appData.getResult().getNewlyCreatedTasks().size() 543 + " new tasks and " 544 + appData.getResult().getNewlyCreatedTaskInstances().size() 545 + " appropriate instances\n"); 546 547 if ((appData.getResult().getNewlyCreatedTasks().size() > 0) 548 || (appData.getResult().getNewlyCreatedTaskInstances().size() > 0)) { 549 appData.getResult().setRuleApplicationStatus( 550 RuleApplicationStatus.FINISHED); 551 } 552 553 return appData.getResult(); 554 } 555 556 private ArrayList<NumberSequence> createNumberSequences( 557 RuleApplicationData appData) { 558 final ArrayList<NumberSequence> result = new ArrayList<NumberSequence>(); 559 for (int i = 0; i < appData.getSessions().size(); i++) { 560 final IUserSession session = appData.getSessions().get(i); 561 final NumberSequence templist = new NumberSequence(session.size()); 562 for (int j = 0; j < session.size(); j++) { 563 final ITaskInstance taskInstance = session.get(j); 564 templist.getSequence()[j] = taskInstance.getTask().getId(); 565 } 566 // Each NumberSequence is identified by its id, beginning to count 567 // at zero 568 templist.setId(i); 569 result.add(templist); 570 } 571 return result; 572 } 573 574 /** 575 * <p> 576 * searches for direct iterations of single tasks in all sequences and 577 * replaces them with {@link IIteration}s, respectively appropriate 578 * instances. Also all single occurrences of a task that is iterated 579 * somewhen are replaced with iterations to have again an efficient way for 580 * task comparisons. 581 * </p> 582 * 583 * @param appData 584 * the rule application data combining all data used for applying 585 * this rule 586 */ 587 private void detectAndReplaceIterations(RuleApplicationData appData) { 588 Console.traceln(Level.FINE, "detecting iterations"); 589 appData.getStopWatch().start("detecting iterations"); 590 591 final List<IUserSession> sessions = appData.getSessions(); 592 593 final Set<ITask> iteratedTasks = searchIteratedTasks(sessions); 594 595 if (iteratedTasks.size() > 0) { 596 replaceIterationsOf(iteratedTasks, sessions, appData); 597 } 598 599 appData.getStopWatch().stop("detecting iterations"); 600 Console.traceln(Level.INFO, "replaced " + iteratedTasks.size() 601 + " iterated tasks"); 602 } 603 604 /** 605 * 606 * @param appData 607 * the rule application data combining all data used for applying 608 * this rule 609 */ 610 private void detectAndReplaceTasks(RuleApplicationData appData) { 611 Console.traceln(Level.FINE, "detecting and replacing tasks"); 612 appData.getStopWatch().start("detecting tasks"); 613 614 // Create NumberSequences 615 appData.setNumberSequences(this.createNumberSequences(appData)); 616 617 // Generate pairwise alignments 618 // appData.setMatchseqs(generatePairwiseAlignments(appData)); 619 generatePairwiseAlignments(appData); 620 621 // Searching each match in all other sessions, counting its occurences 622 searchMatchesInAllSessions(appData); 623 624 // Sort results to get the most occurring results 625 Console.traceln(Level.INFO, "sorting " + appData.getMatchseqs().size() 626 + " results"); 627 final Comparator<Match> comparator = new Comparator<Match>() { 628 @Override 629 public int compare(Match m1, Match m2) { 630 return m2.occurenceCount() - m1.occurenceCount(); 631 632 } 633 }; 634 635 Collections.sort(appData.getMatchseqs(), comparator); 636 appData.getStopWatch().stop("detecting tasks"); 637 638 // Replace matches in the sessions 639 Console.traceln(Level.INFO, "Replacing matches in sessions"); 640 replaceMatches(appData); 641 appData.getStopWatch().start("replacing tasks"); 642 643 // appData.setMatchseqs(null); 644 appData.getStopWatch().stop("replacing tasks"); 645 } 646 647 // private LinkedList<Match> generatePairwiseAlignments(RuleApplicationData 648 // appData) { 649 private void generatePairwiseAlignments(RuleApplicationData appData) { 650 final int numberSeqSize = appData.getNumberSequences().size(); 651 appData.matchseqs = new LinkedList<Match>(); 652 Console.traceln(Level.INFO, "generating pairwise alignments from " 653 + numberSeqSize + " sessions with " + nThreads + " threads"); 654 655 int newThreads = nThreads; 656 if (numberSeqSize < nThreads) { 657 newThreads = numberSeqSize; 658 } 659 660 final ExecutorService executor = Executors 661 .newFixedThreadPool(newThreads); 662 final int interval = numberSeqSize / newThreads; 663 int rest = numberSeqSize % newThreads; 664 665 for (int i = 0; i < (numberSeqSize - interval); i += interval) { 666 int offset = 0; 667 if (rest != 0) { 668 offset = 1; 669 rest--; 670 } 671 final int from = i; 672 final int to = i + interval + offset; 673 System.out.println("Creating thread for sessions " + from 674 + " till " + to); 675 final ParallelPairwiseAligner aligner = new ParallelPairwiseAligner( 676 appData, from, to); 677 executor.execute(aligner); 678 } 679 executor.shutdown(); 680 try { 681 executor.awaitTermination(2, TimeUnit.HOURS); 682 } catch (final InterruptedException e) { 683 // TODO Auto-generated catch block 684 e.printStackTrace(); 685 } 686 } 687 688 /** 689 * <p> 690 * harmonizes the event task instances by unifying tasks. This is done, as 691 * initially the event tasks being equal with respect to the considered task 692 * equality are distinct objects. The comparison of these distinct objects 693 * is more time consuming than comparing the object references. 694 * </p> 695 * 696 * @param appData 697 * the rule application data combining all data used for applying 698 * this rule 699 * @return Returns the unique tasks symbol map 700 */ 701 private void harmonizeEventTaskInstancesModel(RuleApplicationData appData) { 702 Console.traceln(Level.INFO, 703 "harmonizing task model of event task instances"); 704 appData.getStopWatch().start("harmonizing event tasks"); 705 final SymbolMap<ITaskInstance, ITask> uniqueTasks = preparationTaskHandlingStrategy 706 .createSymbolMap(); 707 708 final TaskInstanceComparator comparator = preparationTaskHandlingStrategy 709 .getTaskComparator(); 710 711 int unifiedTasks = 0; 712 ITask task; 713 final List<IUserSession> sessions = appData.getSessions(); 714 for (int j = 0; j < sessions.size(); j++) { 715 final IUserSession session = sessions.get(j); 716 717 for (int i = 0; i < session.size(); i++) { 718 final ITaskInstance taskInstance = session.get(i); 719 task = uniqueTasks.getValue(taskInstance); 720 721 if (task == null) { 722 uniqueTasks.addSymbol(taskInstance, taskInstance.getTask()); 723 appData.getUniqueTasks().add(taskInstance.getTask()); 724 appData.getNumber2Task().put( 725 taskInstance.getTask().getId(), 726 taskInstance.getTask()); 727 } else { 728 taskBuilder.setTask(taskInstance, task); 729 unifiedTasks++; 730 } 731 } 732 comparator.clearBuffers(); 733 } 734 735 appData.getStopWatch().stop("harmonizing event tasks"); 736 Console.traceln(Level.INFO, "harmonized " + unifiedTasks 737 + " task occurrences (still " + appData.getUniqueTasks().size() 738 + " different tasks)"); 739 740 appData.getStopWatch().dumpStatistics(System.out); 741 appData.getStopWatch().reset(); 742 } 743 744 /** 745 * <p> 746 * TODO clarify why this is done 747 * </p> 748 */ 749 private void harmonizeIterationInstancesModel(IIteration iteration, 750 List<IIterationInstance> iterationInstances) { 751 final List<ITask> iteratedTaskVariants = new LinkedList<ITask>(); 752 final TaskInstanceComparator comparator = preparationTaskHandlingStrategy 753 .getTaskComparator(); 754 755 // merge the lexically different variants of iterated task to a unique 756 // list 757 for (final IIterationInstance iterationInstance : iterationInstances) { 758 for (final ITaskInstance executionVariant : iterationInstance) { 759 final ITask candidate = executionVariant.getTask(); 760 761 boolean found = false; 762 for (final ITask taskVariant : iteratedTaskVariants) { 763 if (comparator.areLexicallyEqual(taskVariant, candidate)) { 764 taskBuilder.setTask(executionVariant, taskVariant); 765 found = true; 766 break; 767 } 768 } 769 770 if (!found) { 771 iteratedTaskVariants.add(candidate); 772 } 773 } 774 } 775 776 // if there are more than one lexically different variant of iterated 777 // tasks, adapt the 778 // iteration model to be a selection of different variants. In this case 779 // also adapt 780 // the generated iteration instances to correctly contain selection 781 // instances. If there 782 // is only one variant of an iterated task, simply set this as the 783 // marked task of the 784 // iteration. In this case, the instances can be preserved as is 785 if (iteratedTaskVariants.size() > 1) { 786 final ISelection selection = taskFactory.createNewSelection(); 787 788 for (final ITask variant : iteratedTaskVariants) { 789 taskBuilder.addChild(selection, variant); 790 } 791 792 taskBuilder.setMarkedTask(iteration, selection); 793 794 for (final IIterationInstance instance : iterationInstances) { 795 for (int i = 0; i < instance.size(); i++) { 796 final ISelectionInstance selectionInstance = taskFactory 797 .createNewTaskInstance(selection); 798 taskBuilder.setChild(selectionInstance, instance.get(i)); 799 taskBuilder.setTaskInstance(instance, i, selectionInstance); 800 } 801 } 802 } else { 803 taskBuilder.setMarkedTask(iteration, iteratedTaskVariants.get(0)); 804 } 805 } 806 807 public RuleApplicationData loadAppData(String name) { 808 final String objectName = name; 809 final String filename = name + ".dat"; 810 811 Object data = null; 812 FileInputStream fis = null; 813 ObjectInputStream in = null; 814 try { 815 fis = new FileInputStream(filename); 816 in = new ObjectInputStream(fis); 817 data = in.readObject(); 818 in.close(); 819 } catch (final IOException ex) { 820 Console.logException(ex); 821 } catch (final ClassNotFoundException ex) { 822 Console.logException(ex); 823 } 824 if (GlobalDataContainer.getInstance().addData(objectName, data)) { 825 CommandHelpers.dataOverwritten(objectName); 826 } 827 return (RuleApplicationData) GlobalDataContainer.getInstance().getData( 828 name); 829 } 830 831 /** 832 * @param appData 833 * , Ruleapplication Data needed to keep track of all created 834 * tasks 835 * @param m 836 * The match to be converted into a Task 837 * @return The task of the match with an ISequence as it's root 838 */ 839 synchronized public ISequence matchAsSequence(RuleApplicationData appData, 840 Match m) { 841 final ISequence sequence = taskFactory.createNewSequence(); 842 appData.newTaskCreated(sequence); 843 844 final int[] first = m.getFirstSequence().getSequence(); 845 final int[] second = m.getSecondSequence().getSequence(); 846 847 // Both sequences of a match are equally long 848 for (int i = 0; i < m.getFirstSequence().size(); i++) { 849 850 // Two gaps aligned to each other: Have not seen it happening so 851 // far, just to handle it 852 if ((first[i] == -1) && (second[i] == -1)) { 853 // Do nothing here. 854 } 855 // Both events are equal, we can simply add the task referring to 856 // the number 857 else if (first[i] == second[i]) { 858 taskBuilder.addChild(sequence, 859 appData.getNumber2Task().get(first[i])); 860 } 861 // We have a gap in the first sequence, we need to add the task of 862 // the second sequence as optional 863 else if ((first[i] == -1) && (second[i] != -1)) { 864 final IOptional optional = taskFactory.createNewOptional(); 865 appData.newTaskCreated(optional); 866 taskBuilder.setMarkedTask(optional, appData.getNumber2Task() 867 .get(second[i])); 868 taskBuilder.addChild(sequence, optional); 869 } 870 // We have a gap in the second sequence, we need to add the task of 871 // the first sequence as optional 872 else if ((first[i] != -1) && (second[i] == -1)) { 873 final IOptional optional = taskFactory.createNewOptional(); 874 appData.newTaskCreated(optional); 875 taskBuilder.setMarkedTask(optional, appData.getNumber2Task() 876 .get(first[i])); 877 taskBuilder.addChild(sequence, optional); 878 } 879 // Both tasks are not equal, we need to insert a selection here. 880 // Check if the next position is not a selection 881 else if (i < (first.length - 1)) { 882 883 if ((first[i] != second[i]) 884 && (((first[i + 1] == second[i + 1]) 885 || (first[i + 1] == -1) || (second[i + 1] == -1)))) { 886 887 final ISelection selection = taskFactory 888 .createNewSelection(); 889 appData.newTaskCreated(selection); 890 taskBuilder.addChild(selection, appData.getNumber2Task() 891 .get(first[i])); 892 taskBuilder.addChild(selection, appData.getNumber2Task() 893 .get(second[i])); 894 taskBuilder.addChild(sequence, selection); 895 } else { 896 boolean selectionfound = true; 897 final ISelection selection = taskFactory 898 .createNewSelection(); 899 appData.newTaskCreated(selection); 900 901 final ISequence subsequence1 = taskFactory 902 .createNewSequence(); 903 appData.newTaskCreated(subsequence1); 904 905 final ISequence subsequence2 = taskFactory 906 .createNewSequence(); 907 appData.newTaskCreated(subsequence2); 908 909 taskBuilder.addChild(selection, subsequence1); 910 taskBuilder.addChild(selection, subsequence2); 911 taskBuilder.addChild(sequence, selection); 912 while ((i < (first.length - 1)) && selectionfound) { 913 selectionfound = false; 914 taskBuilder.addChild(subsequence1, appData 915 .getNumber2Task().get(first[i])); 916 taskBuilder.addChild(subsequence2, appData 917 .getNumber2Task().get(second[i])); 918 if ((first[i + 1] != second[i + 1]) 919 && (first[i + 1] != -1) 920 && (second[i + 1] != -1)) { 921 selectionfound = true; 922 } else { 923 continue; 924 } 925 i++; 926 } 927 if ((i == (first.length - 1)) && selectionfound) { 928 taskBuilder.addChild(subsequence1, appData 929 .getNumber2Task().get(first[i])); 930 taskBuilder.addChild(subsequence2, appData 931 .getNumber2Task().get(second[i])); 932 } 933 } 934 } else { 935 if ((first[i] != second[i])) { 936 937 final ISelection selection = taskFactory 938 .createNewSelection(); 939 appData.newTaskCreated(selection); 940 taskBuilder.addChild(selection, appData.getNumber2Task() 941 .get(first[i])); 942 taskBuilder.addChild(selection, appData.getNumber2Task() 943 .get(second[i])); 944 taskBuilder.addChild(sequence, selection); 945 } 946 } 947 948 } 949 return sequence; 950 } 951 952 /** 953 * <p> 954 * replaces all occurrences of all tasks provided in the set with iterations 955 * </p> 956 * 957 * @param iteratedTasks 958 * the tasks to be replaced with iterations 959 * @param sessions 960 * the sessions in which the tasks are to be replaced 961 * @param appData 962 * the rule application data combining all data used for applying 963 * this rule 964 */ 965 private void replaceIterationsOf(Set<ITask> iteratedTasks, 966 List<IUserSession> sessions, RuleApplicationData appData) { 967 final Map<ITask, IIteration> iterations = new HashMap<ITask, IIteration>(); 968 final Map<IIteration, List<IIterationInstance>> iterationInstances = new HashMap<IIteration, List<IIterationInstance>>(); 969 970 for (final ITask iteratedTask : iteratedTasks) { 971 972 final IIteration iteration = taskFactory.createNewIteration(); 973 appData.newTaskCreated(iteration); 974 iterations.put(iteratedTask, iteration); 975 iterationInstances.put(iteration, 976 new LinkedList<IIterationInstance>()); 977 } 978 979 IIterationInstance iterationInstance; 980 981 for (final IUserSession session : sessions) { 982 int index = 0; 983 iterationInstance = null; 984 985 while (index < session.size()) { 986 // we prepared the task instances to refer to unique tasks, if 987 // they are treated 988 // as equal. Therefore, we just compare the identity of the 989 // tasks of the task 990 // instances 991 final ITask currentTask = session.get(index).getTask(); 992 final IIteration iteration = iterations.get(currentTask); 993 if (iteration != null) { 994 if ((iterationInstance == null) 995 || (iterationInstance.getTask() != iteration)) { 996 iterationInstance = taskFactory 997 .createNewTaskInstance(iteration); 998 iterationInstances.get(iteration) 999 .add(iterationInstance);// TODO:: Don't create 1000 // TaskInstances here, 1001 // use a set of tasks 1002 // instead 1003 taskBuilder.addTaskInstance(session, index, 1004 iterationInstance); 1005 index++; 1006 } 1007 1008 taskBuilder.addChild(iterationInstance, session.get(index)); 1009 taskBuilder.removeTaskInstance(session, index); 1010 } else { 1011 if (iterationInstance != null) { 1012 iterationInstance = null; 1013 } 1014 index++; 1015 } 1016 } 1017 } 1018 1019 for (final Map.Entry<IIteration, List<IIterationInstance>> entry : iterationInstances 1020 .entrySet()) { 1021 harmonizeIterationInstancesModel(entry.getKey(), entry.getValue()); 1022 } 1023 } 1024 1025 private void replaceMatches(RuleApplicationData appData) { 1026 appData.replacedOccurences = new HashMap<Integer, List<MatchOccurence>>(); 1027 1028 final int matchSeqSize = appData.getMatchseqs().size(); 1029 int newThreads = nThreads; 1030 if (matchSeqSize < nThreads) { 1031 newThreads = matchSeqSize; 1032 } 1033 final ExecutorService executor = Executors 1034 .newFixedThreadPool(newThreads); 1035 final int interval = matchSeqSize / newThreads; 1036 int rest = matchSeqSize % newThreads; 1037 1038 for (int i = 0; i < (matchSeqSize - interval); i += interval) { 1039 int offset = 0; 1040 if (rest != 0) { 1041 offset = 1; 1042 rest--; 1043 } 1044 final int from = i; 1045 final int to = i + interval + offset; 1046 System.out 1047 .println("Replacement: Creating thread with matches from " 1048 + from + " to " + to); 1049 // search each match in every other sequence 1050 final ParallelMatchReplacer replacer = new ParallelMatchReplacer( 1051 appData, from, to); 1052 executor.execute(replacer); 1053 } 1054 executor.shutdown(); 1055 try { 1056 executor.awaitTermination(2, TimeUnit.HOURS); 1057 } catch (final InterruptedException e) { 1058 // TODO Auto-generated catch block 1059 e.printStackTrace(); 1060 } 1061 } 1062 1063 public void saveAppData(String name) { 1064 final String objectName = name; 1065 final String filename = name + ".dat"; 1066 final Object dataObject = GlobalDataContainer.getInstance().getData( 1067 objectName); 1068 if (dataObject == null) { 1069 CommandHelpers.objectNotFoundMessage(objectName); 1070 } 1071 FileOutputStream fos = null; 1072 ObjectOutputStream out = null; 1073 try { 1074 fos = new FileOutputStream(filename); 1075 out = new ObjectOutputStream(fos); 1076 out.writeObject(dataObject); 1077 out.close(); 1078 } catch (final IOException ex) { 1079 Console.logException(ex); 1080 } 1081 } 1082 1083 /** 1084 * <p> 1085 * searches the provided sessions for task iterations. If a task is 1086 * iterated, it is added to the returned set. 1087 * </p> 1088 * 1089 * @param the 1090 * session to search for iterations in 1091 * 1092 * @return a set of tasks being iterated somewhere 1093 */ 1094 private Set<ITask> searchIteratedTasks(List<IUserSession> sessions) { 1095 final Set<ITask> iteratedTasks = new HashSet<ITask>(); 1096 for (final IUserSession session : sessions) { 1097 for (int i = 0; i < (session.size() - 1); i++) { 1098 // we prepared the task instances to refer to unique tasks, if 1099 // they are treated 1100 // as equal. Therefore, we just compare the identity of the 1101 // tasks of the task 1102 // instances 1103 if (session.get(i).getTask() == session.get(i + 1).getTask()) { 1104 iteratedTasks.add(session.get(i).getTask()); 1105 } 1106 } 1107 } 1108 return iteratedTasks; 1109 } 1110 1111 private void searchMatchesInAllSessions(RuleApplicationData appData) { 1112 Console.traceln(Level.INFO, 1113 "searching for patterns occuring most with " + nThreads 1114 + " threads"); 1115 // Prepare parallel search of matchseqs 1116 1117 final int matchSeqSize = appData.getMatchseqs().size(); 1118 int newThreads = nThreads; 1119 if (matchSeqSize < nThreads) { 1120 newThreads = matchSeqSize; 1121 } 1122 final int interval = matchSeqSize / newThreads; 1123 int rest = matchSeqSize % newThreads; 1124 final ExecutorService executor = Executors.newFixedThreadPool(nThreads); 1125 1126 for (int i = 0; i < (matchSeqSize - interval); i += interval) { 1127 int offset = 0; 1128 if (rest != 0) { 1129 offset = 1; 1130 rest--; 1131 } 1132 final int from = i; 1133 final int to = i + interval + offset; 1134 System.out 1135 .println("Match finding: Creating thread with matches from " 1136 + from + " to " + to); 1137 // search each match in every other sequence 1138 final ParallelMatchOcurrencesFinder finder = new ParallelMatchOcurrencesFinder( 1139 appData, from, to); 1140 executor.execute(finder); 1141 } 1142 executor.shutdown(); 1143 try { 1144 executor.awaitTermination(2, TimeUnit.HOURS); 1145 } catch (final InterruptedException e) { 1146 // TODO Auto-generated catch block 1147 e.printStackTrace(); 1148 } 1149 1150 } 1151 1152 /* 1153 * (non-Javadoc) 1154 * 1155 * @see java.lang.Object#toString() 1156 */ 1157 @Override 1158 public String toString() { 1159 return "SequenceForTaskDetectionRuleAlignment"; 1160 } 1161 1225 1162 1226 } -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskHandlingStrategy.java
r1733 r1734 21 21 import de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy; 22 22 23 // TODO: Auto-generated Javadoc 23 24 /** 24 25 * <p> … … 35 36 public class TaskHandlingStrategy implements SymbolStrategy<ITaskInstance> { 36 37 37 /** */38 /** The Constant serialVersionUID. */ 38 39 private static final long serialVersionUID = 1L; 39 40 40 /** 41 * <p> 42 * the level of task equality considered in this task handling strategy 43 * </p> 44 */ 41 /** <p> the level of task equality considered in this task handling strategy </p>. */ 45 42 private final TaskEquality consideredEquality; 46 43 47 /** 48 * <p> 49 * the comparator used for task comparisons 50 * </p> 51 */ 44 /** <p> the comparator used for task comparisons </p>. */ 52 45 private TaskInstanceComparator comparator; 53 46 … … 56 49 * initializes this strategy with a task equality to be considered for task 57 50 * comparisons g 58 * </p> 51 * </p>. 59 52 * 60 * @param consideredEquality 61 * the task equality to be considered for task comparisons 53 * @param consideredEquality the task equality to be considered for task comparisons 62 54 */ 63 55 public TaskHandlingStrategy(TaskEquality consideredEquality) { … … 117 109 * convenience method to have a correctly typed return value as alternative 118 110 * to {@link #getSymbolComparator()}; 119 * </p> 111 * </p>. 112 * 113 * @return the task comparator 120 114 */ 121 115 public TaskInstanceComparator getTaskComparator() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskIdentityComparator.java
r1733 r1734 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 27 28 class TaskIdentityComparator extends TaskInstanceComparator { 28 29 29 /** */30 /** The Constant serialVersionUID. */ 30 31 private static final long serialVersionUID = 1L; 31 32 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskInstanceComparator.java
r1733 r1734 25 25 import de.ugoe.cs.autoquest.usageprofiles.SymbolComparator; 26 26 27 // TODO: Auto-generated Javadoc 27 28 /** 28 29 * <p> … … 40 41 * <p> 41 42 * interface for internally used comparers containing only a compare method 42 * </p> 43 * </p>. 43 44 */ 44 45 private static interface Comparer { … … 48 49 * returns true, if this comparator considers the provided tasks as 49 50 * equal, false else 50 * </p> 51 * 52 * @param task1 53 * the first task to compare 54 * @param task2 55 * the second task to compare 56 * 51 * </p>. 52 * 53 * @param task1 the first task to compare 54 * @param task2 the second task to compare 57 55 * @return as described 58 56 */ … … 63 61 * <p> 64 62 * comparer that performs comparisons only on the provided level 65 * </p> 63 * </p>. 66 64 */ 67 65 private static class DefaultComparer implements Comparer { 68 66 69 /** 70 * <p> 71 * the minimal task equality considered by this comparer 72 * </p> 73 */ 67 /** <p> the minimal task equality considered by this comparer </p>. */ 74 68 private final TaskEquality minimalTaskEquality; 75 69 … … 77 71 * <p> 78 72 * initializes this comparer with the task equality to be considered 79 * </p> 73 * </p>. 74 * 75 * @param minimalTaskEquality the minimal task equality 80 76 */ 81 77 public DefaultComparer(TaskEquality minimalTaskEquality) { … … 98 94 * <p> 99 95 * comparer that performs comparisons only on the lexical level 100 * </p> 96 * </p>. 101 97 */ 102 98 private static class LexicalComparer implements Comparer { … … 117 113 * <p> 118 114 * comparer that performs comparisons only on the semantical level 119 * </p> 115 * </p>. 120 116 */ 121 117 private static class SemanticalComparer implements Comparer { … … 136 132 * <p> 137 133 * comparer that performs comparisons only on the syntactical level 138 * </p> 139 * 134 * </p>. 140 135 */ 141 136 private static class SyntacticalComparer implements Comparer { … … 153 148 } 154 149 155 /** */150 /** The Constant serialVersionUID. */ 156 151 private static final long serialVersionUID = 1L; 157 152 158 /** 159 * the maximum size of the internal buffer used for storing comparison 160 * results 161 */ 153 /** the maximum size of the internal buffer used for storing comparison results. */ 162 154 private static final int MAX_BUFFER_SIZE = 2 * 1024 * 1024; 163 155 164 /** 165 * the considered level of task equality 166 */ 156 /** the considered level of task equality. */ 167 157 private final TaskEquality minimalTaskEquality; 168 158 169 /** 170 * the comparer used internally for comparing two tasks 171 */ 159 /** the comparer used internally for comparing two tasks. */ 172 160 private transient Comparer comparer; 173 161 174 /** 175 * the comparer used for comparing two tasks on the lexical level 176 */ 162 /** the comparer used for comparing two tasks on the lexical level. */ 177 163 private transient Comparer lexicalComparer; 178 164 179 /** 180 * internal buffer used for storing comparison results 181 */ 165 /** internal buffer used for storing comparison results. */ 182 166 private transient HashMap<Long, Boolean> equalityBuffer = new HashMap<Long, Boolean>(); 183 167 184 /** 185 * internal buffer used for storing comparison results only for lexical 186 * comparisons 187 */ 168 /** internal buffer used for storing comparison results only for lexical comparisons. */ 188 169 private transient HashMap<Long, Boolean> lexicalEqualityBuffer; 189 170 … … 191 172 * <p> 192 173 * initializes the comparator with a considered task equality level 193 * </p> 194 * 195 * @param minimalTaskEquality 196 * the considered task equality level 174 * </p>. 175 * 176 * @param minimalTaskEquality the considered task equality level 197 177 */ 198 178 public TaskInstanceComparator(TaskEquality minimalTaskEquality) { … … 205 185 * returns true, if this comparator considers the provided tasks as 206 186 * lexically equal, false else 207 * </p> 208 * 209 * @param task1 210 * the first task to compare 211 * @param task2 212 * the second task to compare 213 * 187 * </p>. 188 * 189 * @param task1 the first task to compare 190 * @param task2 the second task to compare 214 191 * @return as described 215 192 */ … … 239 216 * <p> 240 217 * can be called externally to clear the internal comparison buffers 241 * </p> 218 * </p>. 242 219 */ 243 220 public void clearBuffers() { … … 250 227 * returns true, if this comparator considers the provided tasks as equal, 251 228 * false else 252 * </p> 253 * 254 * @param task1 255 * the first task to compare 256 * @param task2 257 * the second task to compare 258 * 229 * </p>. 230 * 231 * @param task1 the first task to compare 232 * @param task2 the second task to compare 259 233 * @return as described 260 234 */ … … 329 303 * <p> 330 304 * deserialize this object and reinitialize the buffers 331 * </p> 305 * </p>. 306 * 307 * @param in the in 308 * @throws IOException Signals that an I/O exception has occurred. 309 * @throws ClassNotFoundException the class not found exception 332 310 */ 333 311 private void readObject(ObjectInputStream in) throws IOException, -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskInstanceTrie.java
r1733 r1734 27 27 import de.ugoe.cs.autoquest.usageprofiles.TrieProcessor; 28 28 29 // TODO: Auto-generated Javadoc 29 30 /** 30 31 * <p> … … 45 46 * <p> 46 47 * counter object to be able to call something by the counters reference 47 * </p> 48 * 48 * </p>. 49 * 49 50 * @author Patrick Harms 50 51 */ 51 52 private static class Counter { 53 54 /** The count. */ 52 55 int count = 0; 53 56 } … … 57 60 * trie processor identifying the current maximum count of sequences of a 58 61 * minimal length of two 59 * </p> 60 * 62 * </p>. 63 * 61 64 * @author Patrick Harms 62 65 */ … … 64 67 TrieProcessor<ITaskInstance> { 65 68 66 /** 67 * <p> 68 * the current maximum count 69 * </p> 70 */ 69 /** <p> the current maximum count </p>. */ 71 70 private int currentCount = 0; 72 71 … … 74 73 * <p> 75 74 * returns the current maximum count 76 * </p> 75 * </p>. 76 * 77 * @return the max count 77 78 */ 78 79 private int getMaxCount() { … … 102 103 } 103 104 104 /** */105 /** The Constant serialVersionUID. */ 105 106 private static final long serialVersionUID = 1L; 106 107 107 /** 108 * <p> 109 * the task handling strategy to be used for comparing tasks 110 * </p> 111 */ 108 /** <p> the task handling strategy to be used for comparing tasks </p>. */ 112 109 private final TaskHandlingStrategy taskStrategy; 113 110 … … 115 112 * <p> 116 113 * instantiated the trie with the task handling strategy to be used 117 * </p> 118 * 119 * @param taskStrategy 120 * the task handling strategy to be used for comparing tasks 114 * </p>. 115 * 116 * @param taskStrategy the task handling strategy to be used for comparing tasks 121 117 */ 122 118 public TaskInstanceTrie(TaskHandlingStrategy taskStrategy) { … … 170 166 * internally used convenience method for implementing the training 171 167 * optimization 172 * </p> 168 * </p>. 169 * 170 * @param userSession the user session 171 * @param maxOrder the max order 172 * @param taskInstanceCountMap the task instance count map 173 * @param processedTaskInstances the processed task instances 174 * @param counterRecheckAt the counter recheck at 173 175 */ 174 176 private void train(IUserSession userSession, int maxOrder, -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolBucketedMap.java
r1733 r1734 34 34 import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 35 35 36 // TODO: Auto-generated Javadoc 36 37 /** 37 38 * <p> … … 53 54 * symbol returns false. 54 55 * </p> 55 * 56 * 57 * @author Patrick Harms 58 * @param <V> the value type 56 59 * @see SymbolComparator 57 *58 * @author Patrick Harms59 * @param <V>60 60 */ 61 61 class TaskSymbolBucketedMap<V> implements SymbolMap<ITaskInstance, V>, … … 67 67 * entry, that is relevant. 68 68 * </p> 69 * 69 * 70 70 * @author Patrick Harms 71 * @param <T> the generic type 71 72 */ 72 73 private abstract class EntryFacade<T> { … … 94 95 * task instances or only the values. 95 96 * </p> 96 * 97 * 97 98 * @author Patrick Harms 99 * @param <TYPE> the generic type 98 100 */ 99 101 private class ReadOnlyCollectionFacade<TYPE> implements Collection<TYPE> { 100 102 101 /** 102 * the list facaded by this facade 103 */ 103 /** the list facaded by this facade. */ 104 104 private final List<Map.Entry<ITaskInstance, V>> list; 105 105 106 /** 107 * the facade to be used for the entries 108 */ 106 /** the facade to be used for the entries. */ 109 107 private final EntryFacade<TYPE> entryFacade; 110 108 … … 113 111 * Initializes the facade with the facaded list and the facade to be 114 112 * used for the entries 115 * </p> 113 * </p>. 114 * 115 * @param list the list 116 * @param entryFacade the entry facade 116 117 */ 117 118 private ReadOnlyCollectionFacade( … … 299 300 * of task instance entries. 300 301 * </p> 301 * 302 * 302 303 * @author Patrick Harms 304 * @param <TYPE> the generic type 303 305 */ 304 306 private class ReadOnlyCollectionIteratorFacade<TYPE> implements 305 307 Iterator<TYPE> { 306 308 307 /** 308 * the facaded iterator 309 */ 309 /** the facaded iterator. */ 310 310 private final Iterator<Map.Entry<ITaskInstance, V>> iterator; 311 311 312 /** 313 * the facade for the entries provided by the facaded iterator 314 */ 312 /** the facade for the entries provided by the facaded iterator. */ 315 313 private final EntryFacade<TYPE> entryFacade; 316 314 … … 320 318 * facade to be used for the entries. 321 319 * </p> 320 * 321 * @param iterator the iterator 322 * @param entryFacade the entry facade 322 323 */ 323 324 private ReadOnlyCollectionIteratorFacade( … … 385 386 * <p> 386 387 * Internally used data structure for storing task instance - value pairs 387 * </p> 388 * 388 * </p>. 389 * 389 390 * @author Patrick Harms 390 391 */ 391 392 private class SymbolMapEntry implements Map.Entry<ITaskInstance, V> { 392 393 393 /** 394 * the task instance to map to a value 395 */ 394 /** the task instance to map to a value. */ 396 395 private final ITaskInstance symbol; 397 396 398 /** 399 * the value associated with the symbol 400 */ 397 /** the value associated with the symbol. */ 401 398 private V value; 402 399 … … 406 403 * and its associated value. 407 404 * </p> 405 * 406 * @param symbol the symbol 407 * @param value the value 408 408 */ 409 409 private SymbolMapEntry(ITaskInstance symbol, V value) { … … 507 507 } 508 508 509 /** 510 * <p> 511 * default serial version UID 512 * </p> 513 */ 509 /** <p> default serial version UID </p>. */ 514 510 private static final long serialVersionUID = 1L; 515 511 … … 522 518 private static final int MAX_LIST_SIZE = 15; 523 519 524 /** 525 * <p> 526 * Comparator to be used for comparing the task instances with each other 527 * </p> 528 */ 520 /** <p> Comparator to be used for comparing the task instances with each other </p>. */ 529 521 private final TaskInstanceComparator comparator; 530 522 531 /** 532 * <p> 533 * Internally maintained plain list of task instances and associated values 534 * </p> 535 */ 523 /** <p> Internally maintained plain list of task instances and associated values </p>. */ 536 524 private final List<Map.Entry<ITaskInstance, V>> symbolList; 537 525 … … 556 544 * <p> 557 545 * Instantiates a task instance map with a comparator 558 * </p> 559 * 560 * @param comparator 561 * the comparator to use for comparing task instances 562 * 563 * @throws IllegalArgumentException 564 * if the provided comparator is null 546 * </p>. 547 * 548 * @param comparator the comparator to use for comparing task instances 565 549 */ 566 550 public TaskSymbolBucketedMap(TaskInstanceComparator comparator) { … … 576 560 * <p> 577 561 * Copy constructor 578 * </p> 579 * 580 * @param otherMap 581 * the other map to be copied including its comparator 582 * 583 * @throws IllegalArgumentException 584 * if the provided other map is null 562 * </p>. 563 * 564 * @param otherMap the other map to be copied including its comparator 585 565 */ 586 566 public TaskSymbolBucketedMap(TaskSymbolBucketedMap<V> otherMap) { … … 608 588 * should be used to ensure map behavior. 609 589 * </p> 610 * 611 * @param symbol 612 * the task instance to add to the map 613 * @param value 614 * the value to associate to the task instance in this map 615 * 590 * 591 * @param symbol the task instance to add to the map 592 * @param value the value to associate to the task instance in this map 616 593 * @return as described 617 *618 * @throws IllegalArgumentException619 * if the provided task instance is null620 594 */ 621 595 @Override … … 648 622 * id is shifted to another value. 649 623 * </p> 624 * 625 * @param symbolEntry the symbol entry 650 626 */ 651 627 private void addToSymbolBucket(Map.Entry<ITaskInstance, V> symbolEntry) { … … 687 663 * Returns true if the provided task instance was stored in this map. 688 664 * </p> 689 * 690 * @param symbol 691 * the task instance to check if it was stored in this map 692 * 665 * 666 * @param symbol the task instance to check if it was stored in this map 693 667 * @return as described 694 *695 * @throws IllegalArgumentException696 * if the provided task instance is null697 668 */ 698 669 @Override … … 745 716 * task instances, sequence instances, selection instances, and iteration 746 717 * instances 747 * </p> 718 * </p>. 719 * 720 * @param taskInstance the task instance 721 * @return the bucket search order 748 722 */ 749 723 private int[] getBucketSearchOrder(ITaskInstance taskInstance) { … … 785 759 * the other buckets are searched for the task instance. 786 760 * </p> 761 * 762 * @param symbol the symbol 763 * @return the entry 787 764 */ 788 765 private Map.Entry<ITaskInstance, V> getEntry(ITaskInstance symbol) { … … 844 821 * instance is not stored in this map, the method returns null. 845 822 * </p> 846 * 847 * @param symbol 848 * the task instance to return the value for 849 * 823 * 824 * @param symbol the task instance to return the value for 850 825 * @return as described 851 *852 * @throws IllegalArgumentException853 * if the provided task instance is null854 826 */ 855 827 @Override … … 910 882 * comparator. 911 883 * </p> 884 * 885 * @param symbol the symbol 886 * @param list the list 887 * @return the map. entry 912 888 */ 913 889 private Map.Entry<ITaskInstance, V> lookup(ITaskInstance symbol, … … 928 904 * possible. 929 905 * </p> 906 * 907 * @param symbol the symbol 908 * @return the map. entry 930 909 */ 931 910 private Map.Entry<ITaskInstance, V> removeFromSymbolBuckets( … … 964 943 * is removed. 965 944 * </p> 966 * 967 * @param symbol 968 * the task instance to be removed from the map 969 * 945 * 946 * @param symbol the task instance to be removed from the map 970 947 * @return as described 971 *972 * @throws IllegalArgumentException973 * if the provided task instance is null974 948 */ 975 949 @Override … … 999 973 * <p> 1000 974 * Updates the default bucket id to a new one 1001 * </p> 975 * </p>. 1002 976 */ 1003 977 private void setNewDefaultBucketId() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolIdentityMap.java
r1733 r1734 23 23 import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 24 24 25 // TODO: Auto-generated Javadoc 25 26 /** 26 27 * <p> 27 28 * symbol map implementation for task instances considering two task instances 28 29 * as equal if their tasks are identical 29 * </p> 30 * 30 * </p>. 31 * 31 32 * @author Patrick Harms 33 * @param <V> the value type 32 34 */ 33 35 public class TaskSymbolIdentityMap<V> implements SymbolMap<ITaskInstance, V> { 34 36 35 /** */37 /** The Constant serialVersionUID. */ 36 38 private static final long serialVersionUID = 1L; 37 39 38 /** 39 * <p> 40 * internally used map for implementing the symbol map interface 41 * </p> 42 */ 40 /** <p> internally used map for implementing the symbol map interface </p>. */ 43 41 private final Map<ITask, V> delegate; 44 42 … … 54 52 * <p> 55 53 * initializes this map 56 * </p> 54 * </p>. 57 55 */ 58 56 public TaskSymbolIdentityMap() { … … 64 62 * <p> 65 63 * copy constructor 66 * </p> 64 * </p>. 67 65 * 68 * @param other 69 * the map to be copied 66 * @param other the map to be copied 70 67 */ 71 68 public TaskSymbolIdentityMap(SymbolMap<ITaskInstance, V> other) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java
r1733 r1734 29 29 import de.ugoe.cs.util.console.Console; 30 30 31 // TODO: Auto-generated Javadoc 31 32 /** 32 33 * TODO update comment … … 85 86 public class TemporalRelationshipRuleManager { 86 87 87 /** 88 * <p> 89 * the task factory to be used during rule application 90 * </p> 91 */ 88 /** <p> the task factory to be used during rule application </p>. */ 92 89 private final ITaskFactory taskFactory; 93 90 94 /** 95 * <p> 96 * the task builder to be used during rule application 97 * </p> 98 */ 91 /** <p> the task builder to be used during rule application </p>. */ 99 92 private final ITaskBuilder taskBuilder; 100 93 … … 120 113 * <p> 121 114 * initialize the manager 122 * </p> 123 * 124 * @param taskFactory 125 * the task factory to be used for instantiating new task tree 115 * </p>. 116 * 117 * @param taskFactory the task factory to be used for instantiating new task tree 126 118 * tasks during rule application 127 * @param taskBuilder 128 * the task builder to be used for linking tasks with each other 119 * @param taskBuilder the task builder to be used for linking tasks with each other 129 120 * during rule application 130 121 */ … … 147 138 * parameter is always true. 148 139 * </p> 149 * 150 * @param parent 151 * the parent task to apply the rules on 152 * @param finalize 153 * used to indicate, if the rule application shall break up if a 154 * rule would be feasible if further data was available, or not. 155 * @param logIndent 156 * simply used for logging purposes to indent the log messages 140 * 141 * @param rules the rules 142 * @param sessions the sessions 143 * @param logIndent simply used for logging purposes to indent the log messages 157 144 * depending on the recursion depth of calling this method. 145 * @return the int 158 146 */ 159 147 private int applyRules(ISessionScopeRule[] rules, … … 209 197 * parameter is always true. 210 198 * </p> 211 * 212 * @param parent 213 * the parent task to apply the rules on 214 * @param finalize 215 * used to indicate, if the rule application shall break up if a 216 * rule would be feasible if further data was available, or not. 217 * @param logIndent 218 * simply used for logging purposes to indent the log messages 199 * 200 * @param rules the rules 201 * @param taskInstance the task instance 202 * @param logIndent simply used for logging purposes to indent the log messages 219 203 * depending on the recursion depth of calling this method. 204 * @return the int 220 205 */ 221 206 private int applyRules(ITaskInstanceScopeRule[] rules, … … 267 252 * the rule application. 268 253 * </p> 269 * 270 * @param taskFactory 271 * the task factory to be used for instantiating new tasks. 254 * 255 * @param sessions the sessions 272 256 */ 273 257 public void applyRules(List<IUserSession> sessions) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/DefaultTaskInstanceTraversingVisitor.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> 19 20 * Default implementation for a task instance visitor performing a traversal of 20 21 * the instances 21 * </p> 22 * 22 * </p>. 23 * 23 24 * @author Patrick Harms 24 25 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/DefaultTaskTraversingVisitor.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> 19 20 * Default implementation for a task visitor performing a traversal of the task 20 * </p> 21 * 21 * </p>. 22 * 22 23 * @author Patrick Harms 23 24 */ … … 49 50 * <p> 50 51 * common implementation for traversing a marking temporal relationship 51 * </p> 52 * 53 * @param relationship 54 * the marking temporal relationship to be traversed 52 * </p>. 53 * 54 * @param relationship the marking temporal relationship to be traversed 55 55 */ 56 56 public void visit(IMarkingTemporalRelationship relationship) { … … 94 94 * <p> 95 95 * common implementation for traversing a structuring temporal relationship 96 * </p> 97 * 98 * @param relationship 99 * the structuring temporal relationship to be traversed 96 * </p>. 97 * 98 * @param relationship the structuring temporal relationship to be traversed 100 99 */ 101 100 public void visit(IStructuringTemporalRelationship relationship) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IEventTask.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IEventTaskInstance.java
r1733 r1734 17 17 import de.ugoe.cs.autoquest.eventcore.Event; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> … … 41 42 * <p> 42 43 * returns the event represented by this event task instance 43 * </p> 44 * 44 * </p>. 45 * 45 46 * @return as described 46 47 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IIteration.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IIterationInstance.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 30 31 * clones this task instance by creating exact clones of each contained 31 32 * instance in their order 32 * </p> 33 * 33 * </p>. 34 * 34 35 * @return a clone of the task instance list 35 36 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IMarkingTemporalRelationship.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IOptional.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IOptionalInstance.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 31 32 * clones this task instance by creating exact clones of each contained 32 33 * instance 33 * </p> 34 * 34 * </p>. 35 * 35 36 * @return a clone of the task instance 36 37 */ … … 42 43 * returns the child of the optional of null if the optional was not 43 44 * executed 44 * </p> 45 * 45 * </p>. 46 * 46 47 * @return as described 47 48 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISelection.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISelectionInstance.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 29 30 * clones this task instance by creating exact clones of the contained 30 31 * instance 31 * </p> 32 * 32 * </p>. 33 * 33 34 * @return a clone of the task instance 34 35 */ … … 39 40 * <p> 40 41 * returns the selected child of the selection 41 * </p> 42 * 42 * </p>. 43 * 43 44 * @return as described 44 45 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISequence.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISequenceInstance.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 29 30 * clones this task instance by creating exact clones of each contained 30 31 * instance in their order 31 * </p> 32 * 32 * </p>. 33 * 33 34 * @return a clone of the task instance 34 35 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IStructuringTemporalRelationship.java
r1733 r1734 17 17 import java.util.List; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITask.java
r1733 r1734 18 18 import java.util.Collection; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 63 64 * of it. 64 65 * </p> 65 * 66 * 67 * @param task the task 66 68 * @return as described 67 69 */ … … 101 103 * <p> 102 104 * returns a collection of all observed instances of this task 103 * </p> 104 * 105 * </p>. 106 * 105 107 * @return as described 106 108 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskBuilder.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 45 46 * <p> 46 47 * adds a child task to a selection 47 * </p> 48 * 49 * @param parent 50 * the selection to add the child to 51 * @param child 52 * the child to be added 48 * </p>. 49 * 50 * @param parent the selection to add the child to 51 * @param child the child to be added 53 52 */ 54 53 void addChild(ISelection parent, ITask child); … … 57 56 * <p> 58 57 * adds a child task to a specific index of a sequence 59 * </p> 60 * 61 * @param parent 62 * the sequence to add the child to 63 * @param index 64 * the index to set the child at 65 * @param child 66 * the child to be added 67 * 68 * @throws IndexOutOfBoundsException 69 * if the index is invalid 58 * </p>. 59 * 60 * @param parent the sequence to add the child to 61 * @param index the index to set the child at 62 * @param child the child to be added 63 * @throws IndexOutOfBoundsException if the index is invalid 70 64 */ 71 65 void addChild(ISequence parent, int index, ITask child) … … 75 69 * <p> 76 70 * adds a child task to the end of a sequence 77 * </p> 78 * 79 * @param parent 80 * the sequence to add the child to 81 * @param child 82 * the child to be added 71 * </p>. 72 * 73 * @param parent the sequence to add the child to 74 * @param child the child to be added 83 75 */ 84 76 void addChild(ISequence parent, ITask child); … … 105 97 * <p> 106 98 * adds a task instance to a user session 107 * </p> 108 * 109 * @param session 110 * the session to add the task instance to 111 * @param taskInstance 112 * the task instance to add 99 * </p>. 100 * 101 * @param session the session to add the task instance to 102 * @param taskInstance the task instance to add 113 103 */ 114 104 void addExecutedTask(IUserSession session, ITaskInstance taskInstance); … … 136 126 * <p> 137 127 * adds a task instance to a task instance list 138 * </p> 139 * 140 * @param taskInstanceList 141 * the list to add the task instance to 142 * @param taskInstance 143 * the task instance to add 128 * </p>. 129 * 130 * @param taskInstanceList the list to add the task instance to 131 * @param taskInstance the task instance to add 144 132 */ 145 133 void addTaskInstance(ITaskInstanceList taskInstanceList, … … 162 150 * <p> 163 151 * removes the child of a sequence at a specific position 164 * </p> 165 * 166 * @param parent 167 * the sequence of which the child must be removed 168 * @param index 169 * the index of the child to be removed 170 * 171 * @throws IndexOutOfBoundsException 172 * if the index is invalid 152 * </p>. 153 * 154 * @param parent the sequence of which the child must be removed 155 * @param index the index of the child to be removed 156 * @throws IndexOutOfBoundsException if the index is invalid 173 157 */ 174 158 void removeChild(ISequence parent, int index) … … 178 162 * <p> 179 163 * removes the entry of a task instance list at a specific position 180 * </p> 181 * 182 * @param taskInstanceList 183 * the task instance list of which the entry must be removed 184 * @param index 185 * the index of the entry to be removed 186 * 187 * @throws IndexOutOfBoundsException 188 * if the index is invalid 164 * </p>. 165 * 166 * @param taskInstanceList the task instance list of which the entry must be removed 167 * @param index the index of the entry to be removed 168 * @throws IndexOutOfBoundsException if the index is invalid 189 169 */ 190 170 void removeTaskInstance(ITaskInstanceList taskInstanceList, int index) … … 196 176 * the child is not found (comparison using equals). 197 177 * </p> 198 * 199 * @param parent 200 * the selection of which the child must be replace 201 * @param oldChild 202 * the child to replace 203 * @param newChild 204 * the replacement for the child 205 * 206 * @throws as 207 * described 178 * 179 * @param parent the selection of which the child must be replace 180 * @param oldChild the child to replace 181 * @param newChild the replacement for the child 208 182 */ 209 183 void replaceChild(ISelection parent, ITask oldChild, ITask newChild); … … 248 222 * <p> 249 223 * replaces the child task of a sequence at a specific position 250 * </p> 251 * 252 * @param parent 253 * the sequence to replace the child in 254 * @param index 255 * the index to replace the child at 256 * @param child 257 * the child to be added 258 * 259 * @throws IndexOutOfBoundsException 260 * if the index is invalid 224 * </p>. 225 * 226 * @param parent the sequence to replace the child in 227 * @param index the index to replace the child at 228 * @param child the child to be added 229 * @throws IndexOutOfBoundsException if the index is invalid 261 230 */ 262 231 void setChild(ISequence parent, int index, ITask child) … … 266 235 * <p> 267 236 * sets the child task of an iteration 268 * </p> 269 * 270 * @param iteration 271 * the iteration to set the child of 272 * @param child 273 * the child to be set 237 * </p>. 238 * 239 * @param iteration the iteration to set the child of 240 * @param child the child to be set 274 241 */ 275 242 void setMarkedTask(IIteration iteration, ITask child); … … 278 245 * <p> 279 246 * sets the child task of an optional 280 * </p> 281 * 282 * @param optional 283 * the optional to set the child of 284 * @param child 285 * the child to be set 247 * </p>. 248 * 249 * @param optional the optional to set the child of 250 * @param child the child to be set 286 251 */ 287 252 void setMarkedTask(IOptional optional, ITask child); … … 290 255 * <p> 291 256 * sets the task model of a task instance 292 * </p> 293 * 294 * @param taskInstance 295 * the task instance to set the task model for 296 * @param task 297 * the task model of the instance 257 * </p>. 258 * 259 * @param taskInstance the task instance to set the task model for 260 * @param task the task model of the instance 298 261 */ 299 262 void setTask(ITaskInstance taskInstance, ITask task); … … 302 265 * <p> 303 266 * sets a task instance in a task instance list at a specific position 304 * </p> 305 * 306 * @param taskInstanceList 307 * the list to set the task instance in 308 * @param index 309 * the index of the task instance to replace 310 * @param taskInstance 311 * the replacement for the task instance at the index 312 * 313 * @throws IndexOutOfBoundsException 314 * if the index is invalid 267 * </p>. 268 * 269 * @param taskInstanceList the list to set the task instance in 270 * @param index the index of the task instance to replace 271 * @param taskInstance the replacement for the task instance at the index 272 * @throws IndexOutOfBoundsException if the index is invalid 315 273 */ 316 274 void setTaskInstance(ITaskInstanceList taskInstanceList, int index, -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskFactory.java
r1733 r1734 19 19 import de.ugoe.cs.autoquest.eventcore.Event; 20 20 21 // TODO: Auto-generated Javadoc 21 22 /** 22 23 * <p> 23 24 * factory for the different task types 24 * </p> 25 * 25 * </p>. 26 * 26 27 * @author Patrick Harms 27 28 */ … … 31 32 * <p> 32 33 * creates a new event task with the given description 33 * </p> 34 * 35 * @param description 36 * the description for the represented events 37 * 34 * </p>. 35 * 36 * @param description the description for the represented events 38 37 * @return the event task 39 38 */ … … 43 42 * <p> 44 43 * creates a new empty iteration 45 * </p> 46 * 44 * </p>. 45 * 47 46 * @return the iteration 48 47 */ … … 52 51 * <p> 53 52 * creates a new empty optional 54 * </p> 55 * 53 * </p>. 54 * 56 55 * @return the optional 57 56 */ … … 61 60 * <p> 62 61 * creates a new empty selection 63 * </p> 64 * 62 * </p>. 63 * 65 64 * @return the selection 66 65 */ … … 70 69 * <p> 71 70 * creates a new empty sequence 72 * </p> 73 * 71 * </p>. 72 * 74 73 * @return the sequence 75 74 */ … … 80 79 * creates a new task instance with the given task as its model representing 81 80 * the provided event 82 * </p> 83 * 84 * @param task 85 * the model of the task instance to be created 86 * @param event 87 * the event represented by the task instance 88 * 81 * </p>. 82 * 83 * @param task the model of the task instance to be created 84 * @param event the event represented by the task instance 89 85 * @return the task instance 90 86 */ … … 94 90 * <p> 95 91 * creates a new task instance with the given iteration as its model 96 * </p> 97 * 98 * @param iteration 99 * the model of the task instance to be created 100 * 92 * </p>. 93 * 94 * @param iteration the model of the task instance to be created 101 95 * @return the task instance 102 96 */ … … 106 100 * <p> 107 101 * creates a new task instance with the given optional as its model 108 * </p> 109 * 110 * @param optional 111 * the model of the task instance to be created 112 * 102 * </p>. 103 * 104 * @param optional the model of the task instance to be created 113 105 * @return the task instance 114 106 */ … … 118 110 * <p> 119 111 * creates a new task instance with the given selection as its model 120 * </p> 121 * 122 * @param selection 123 * the model of the task instance to be created 124 * 112 * </p>. 113 * 114 * @param selection the model of the task instance to be created 125 115 * @return the task instance 126 116 */ … … 130 120 * <p> 131 121 * creates a new task instance with the given sequence as its model 132 * </p> 133 * 134 * @param sequence 135 * the model of the task instance to be created 136 * 122 * </p>. 123 * 124 * @param sequence the model of the task instance to be created 137 125 * @return the task instance 138 126 */ … … 142 130 * <p> 143 131 * creates a task model based on the provided user sessions 144 * </p> 145 * 146 * @param userSessions 147 * the session based on which the task model shall be created 148 * 132 * </p>. 133 * 134 * @param userSessions the session based on which the task model shall be created 149 135 * @return the task model 150 136 */ … … 154 140 * <p> 155 141 * creates a new empty user session 156 * </p> 157 * 142 * </p>. 143 * 158 144 * @return the user session 159 145 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInfo.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> … … 29 30 * <p> 30 31 * represents a measure for a specific metric 31 * </p> 32 * 32 * </p>. 33 * 33 34 * @author Patrick Harms 34 35 */ … … 38 39 * <p> 39 40 * returns the metric of the measure 40 * </p> 41 * 41 * </p>. 42 * 42 43 * @return as described 43 44 */ … … 47 48 * <p> 48 49 * returns the value of the measure 49 * </p> 50 * 50 * </p>. 51 * 51 52 * @return as described 52 53 */ … … 58 59 * specific context, i.e. parent task 59 60 * </p> 60 * 61 * 62 * @param context the context 61 63 * @return as described 62 64 */ … … 68 70 * <p> 69 71 * returns all available measures 70 * </p> 71 * 72 * </p>. 73 * 72 74 * @return as described 73 75 */ … … 77 79 * <p> 78 80 * returns the value of the measure identified through the given metric 79 * </p> 81 * </p>. 80 82 * 81 * @param metric 82 * the metric for which the value is to be returned 83 * 83 * @param metric the metric for which the value is to be returned 84 84 * @return as described 85 85 */ … … 105 105 * <p> 106 106 * returns the task to which these infos belong 107 * </p> 108 * 107 * </p>. 108 * 109 109 * @return as described 110 110 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstance.java
r1733 r1734 17 17 import java.io.Serializable; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> … … 76 77 * returns a hash code for the task instance to be able to put it into hash 77 78 * maps 78 * </p> 79 * 79 * </p>. 80 * 80 81 * @return as described 81 82 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstanceList.java
r1733 r1734 17 17 import java.io.Serializable; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstanceVisitor.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskModel.java
r1733 r1734 19 19 import java.util.List; 20 20 21 // TODO: Auto-generated Javadoc 21 22 /** 22 23 * <p> … … 45 46 * returns a list of all metrics calculated by this model for the tasks and 46 47 * stored in the respective task infos 47 * </p> 48 * </p>. 48 49 * 49 50 * @return as described … … 56 57 * if the provided task does not belong to the model. 57 58 * </p> 58 * 59 * 60 * @param task the task 59 61 * @return as described 60 62 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskVisitor.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITemporalRelationship.java
r1733 r1734 15 15 package de.ugoe.cs.autoquest.tasktrees.treeifc; 16 16 17 // TODO: Auto-generated Javadoc 17 18 /** 18 19 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IUserSession.java
r1733 r1734 17 17 import java.util.List; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> … … 33 34 * clones a user session by creating exact clones of each contained instance 34 35 * in their order 35 * </p> 36 * 36 * </p>. 37 * 37 38 * @return a clone of the session 38 39 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/TaskMetric.java
r1733 r1734 17 17 import java.text.DecimalFormat; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> … … 28 29 public enum TaskMetric { 29 30 30 COUNT("count", "number of all occurrences of the task in the model"), DEPTH( 31 /** The count. */ 32 COUNT("count", "number of all occurrences of the task in the model"), /** The depth. */ 33 DEPTH( 31 34 "depth", 32 35 "the maximum depth of the task, i.e., the number of children levels including the " 33 + "level of the task itself"), EVENT_COVERAGE( 36 + "level of the task itself"), 37 /** The event coverage. */ 38 EVENT_COVERAGE( 34 39 "covered events", 35 "number of all event task instances covered by the task"), EVENT_COVERAGE_RATIO( 40 "number of all event task instances covered by the task"), 41 /** The event coverage ratio. */ 42 EVENT_COVERAGE_RATIO( 36 43 "event coverage ratio", 37 44 "the ratio of events covered by this task in relation to all events " 38 45 + "covered by all tasks in their instances in per mille", 39 0.1, "%"), EVENT_COVERAGE_QUANTILE("event coverage ratio quantile", 46 0.1, "%"), 47 /** The event coverage quantile. */ 48 EVENT_COVERAGE_QUANTILE("event coverage ratio quantile", 40 49 "the quantile of with respect to all event coverages begining with " 41 50 + "the lowest", 0.1, "%"); 42 51 43 /** 44 * <p> 45 * the name of the metric 46 * </p> 47 */ 52 /** <p> the name of the metric </p>. */ 48 53 private String name; 49 54 50 /** 51 * <p> 52 * a human readable description of the metric 53 * </p> 54 */ 55 /** <p> a human readable description of the metric </p>. */ 55 56 private String description; 56 57 57 /** 58 * <p> 59 * a scale applied for the metric when formatting the value 60 * </p> 61 */ 58 /** <p> a scale applied for the metric when formatting the value </p>. */ 62 59 private double formatScale; 63 60 64 /** 65 * <p> 66 * the unit of the metric used when formatting the value 67 * </p> 68 */ 61 /** <p> the unit of the metric used when formatting the value </p>. */ 69 62 private String formatUnit; 70 63 … … 72 65 * <p> 73 66 * initializes the metric with a name and a description 74 * </p> 67 * </p>. 68 * 69 * @param name the name 70 * @param description the description 75 71 */ 76 72 private TaskMetric(String name, String description) { … … 86 82 * scale and a unit for formatting it. 87 83 * </p> 84 * 85 * @param name the name 86 * @param description the description 87 * @param formatScale the format scale 88 * @param formatUnit the format unit 88 89 */ 89 90 private TaskMetric(String name, String description, double formatScale, … … 100 101 * format scale and unit. 101 102 * </p> 102 * 103 * 104 * @param value the value 103 105 * @return the formatted value depending on the scale and unit of the metric 104 106 */ … … 124 126 * <p> 125 127 * returns the human readable description of the metric 126 * </p> 127 * 128 * </p>. 129 * 128 130 * @return the human readable description of the metric 129 131 */ … … 135 137 * <p> 136 138 * returns the name of the metric 137 * </p> 138 * 139 * </p>. 140 * 139 141 * @return the name of the metric 140 142 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/EventTask.java
r1733 r1734 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 28 29 class EventTask extends Task implements IEventTask { 29 30 30 /** 31 * <p> 32 * default serial version UID 33 * </p> 34 */ 31 /** <p> default serial version UID </p>. */ 35 32 private static final long serialVersionUID = 1L; 36 33 … … 39 36 * simple constructor initializing this task with a description for the 40 37 * represented events 41 * </p> 42 * 43 * @param type 44 * a type for the represented events 38 * </p>. 39 * 40 * @param type a type for the represented events 45 41 */ 46 42 EventTask(String type) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/EventTaskInstance.java
r1733 r1734 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 20 20 21 // TODO: Auto-generated Javadoc 21 22 /** 22 23 * <p> … … 28 29 class EventTaskInstance extends TaskInstance implements IEventTaskInstance { 29 30 30 /** 31 * <p> 32 * default serial version UID 33 * </p> 34 */ 31 /** <p> default serial version UID </p>. */ 35 32 private static final long serialVersionUID = 1L; 36 33 37 /** 38 * <p> 39 * the event represented by this instance 40 * </p> 41 */ 34 /** <p> the event represented by this instance </p>. */ 42 35 private final Event event; 43 36 … … 46 39 * initializes this instance with the respective task model and the 47 40 * represented event 48 * </p> 41 * </p>. 49 42 * 50 * @param task 51 * the task of which this is an instance 52 * @param event 53 * the event represented by this instance 43 * @param task the task of which this is an instance 44 * @param event the event represented by this instance 54 45 */ 55 46 EventTaskInstance(IEventTask task, Event event) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Iteration.java
r1733 r1734 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 20 20 21 // TODO: Auto-generated Javadoc 21 22 /** 22 23 * <p> … … 29 30 class Iteration extends MarkingTemporalRelationship implements IIteration { 30 31 31 /** 32 * <p> 33 * default serial version UID 34 * </p> 35 */ 32 /** <p> default serial version UID </p>. */ 36 33 private static final long serialVersionUID = 1L; 37 34 … … 40 37 * simple constructor providing the base class with a human readable name of 41 38 * the type of this task 42 * </p> 39 * </p>. 43 40 */ 44 41 Iteration() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/IterationInstance.java
r1733 r1734 24 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 25 25 26 // TODO: Auto-generated Javadoc 26 27 /** 27 28 * <p> … … 33 34 class IterationInstance extends TaskInstance implements IIterationInstance { 34 35 35 /** 36 * <p> 37 * default serial version UID 38 * </p> 39 */ 36 /** <p> default serial version UID </p>. */ 40 37 private static final long serialVersionUID = 1L; 41 38 42 /** 43 * <p> 44 * the children of this task instance which are task instances, as well 45 * </p> 46 */ 39 /** <p> the children of this task instance which are task instances, as well </p>. */ 47 40 private List<ITaskInstance> children; 48 41 … … 50 43 * <p> 51 44 * initializes this instance with the respective task model 52 * </p> 45 * </p>. 53 46 * 54 * @param task 55 * the task of which this is an instance 47 * @param task the task of which this is an instance 56 48 */ 57 49 IterationInstance(IIteration task) { … … 62 54 * <p> 63 55 * used to add a child to this task instance at a specific position 64 * </p> 65 * 66 * @param index 67 * the position of the new child in the list of children 68 * @param child 69 * the new child of this instance 56 * </p>. 57 * 58 * @param index the position of the new child in the list of children 59 * @param child the new child of this instance 70 60 */ 71 61 synchronized void addChild(int index, ITaskInstance child) { … … 80 70 * <p> 81 71 * used to add a child to this task instance 82 * </p> 83 * 84 * @param child 85 * the new child of this instance 72 * </p>. 73 * 74 * @param child the new child of this instance 86 75 */ 87 76 synchronized void addChild(ITaskInstance child) { … … 132 121 * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance#getChildren() 133 122 */ 123 /** 124 * Gets the children. 125 * 126 * @return the children 127 */ 134 128 public synchronized List<ITaskInstance> getChildren() { 135 129 if (children == null) { … … 164 158 * <p> 165 159 * removes a child from this task instance at a specific position 166 * </p> 167 * 168 * @param index 169 * the position of the child to be removed 170 * 160 * </p>. 161 * 162 * @param index the position of the child to be removed 171 163 * @return the child removed from the children of this instance 172 164 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/MarkingTemporalRelationship.java
r1733 r1734 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 30 31 IMarkingTemporalRelationship { 31 32 32 /** 33 * <p> 34 * default serial version UID 35 * </p> 36 */ 33 /** <p> default serial version UID </p>. */ 37 34 private static final long serialVersionUID = 1L; 38 35 39 /** 40 * <p> 41 * the task marked through this marking temporal relationship 42 * </p> 43 */ 36 /** <p> the task marked through this marking temporal relationship </p>. */ 44 37 private ITask markedTask; 45 38 … … 47 40 * <p> 48 41 * initializes this temporal relationship with a human readable name 49 * </p> 42 * </p>. 50 43 * 51 * @param relationshipType 52 * the human readable name of this temporal relationship 44 * @param relationshipType the human readable name of this temporal relationship 53 45 */ 54 46 MarkingTemporalRelationship(String relationshipType) { … … 92 84 * <p> 93 85 * used to set the marked task 94 * </p> 95 * 96 * @param markedTask 97 * the marked task to set 86 * </p>. 87 * 88 * @param markedTask the marked task to set 98 89 */ 99 90 protected void setMarkedTask(ITask markedTask) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Optional.java
r1733 r1734 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 28 29 class Optional extends MarkingTemporalRelationship implements IOptional { 29 30 30 /** 31 * <p> 32 * default serial version UID 33 * </p> 34 */ 31 /** <p> default serial version UID </p>. */ 35 32 private static final long serialVersionUID = 1L; 36 33 … … 39 36 * simple constructor providing the base class with a human readable name of 40 37 * the type of this task 41 * </p> 38 * </p>. 42 39 */ 43 40 Optional() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/OptionalInstance.java
r1733 r1734 20 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 21 21 22 // TODO: Auto-generated Javadoc 22 23 /** 23 24 * <p> … … 29 30 class OptionalInstance extends TaskInstance implements IOptionalInstance { 30 31 31 /** 32 * <p> 33 * default serial version UID 34 * </p> 35 */ 32 /** <p> default serial version UID </p>. */ 36 33 private static final long serialVersionUID = 1L; 37 34 38 /** 39 * <p> 40 * the child of this task instance if any 41 * </p> 42 */ 35 /** <p> the child of this task instance if any </p>. */ 43 36 private ITaskInstance child; 44 37 … … 46 39 * <p> 47 40 * initializes this instance with the respective task model 48 * </p> 41 * </p>. 49 42 * 50 * @param task 51 * the task of which this is an instance 43 * @param task the task of which this is an instance 52 44 */ 53 45 OptionalInstance(ITask task) { … … 95 87 * <p> 96 88 * used to set the child of this task instance 97 * </p> 98 * 99 * @param child 100 * the new child of this instance 89 * </p>. 90 * 91 * @param child the new child of this instance 101 92 */ 102 93 void setChild(ITaskInstance child) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Selection.java
r1733 r1734 18 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 19 19 20 // TODO: Auto-generated Javadoc 20 21 /** 21 22 * <p> … … 28 29 class Selection extends StructuringTemporalRelationship implements ISelection { 29 30 30 /** 31 * <p> 32 * default serial version UID 33 * </p> 34 */ 31 /** <p> default serial version UID </p>. */ 35 32 private static final long serialVersionUID = 1L; 36 33 … … 39 36 * simple constructor providing the base class with a human readable name of 40 37 * the type of this task 41 * </p> 38 * </p>. 42 39 */ 43 40 Selection() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/SelectionInstance.java
r1733 r1734 20 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 21 21 22 // TODO: Auto-generated Javadoc 22 23 /** 23 24 * <p> … … 29 30 class SelectionInstance extends TaskInstance implements ISelectionInstance { 30 31 31 /** 32 * <p> 33 * default serial version UID 34 * </p> 35 */ 32 /** <p> default serial version UID </p>. */ 36 33 private static final long serialVersionUID = 1L; 37 34 38 /** 39 * <p> 40 * the child of this task instance 41 * </p> 42 */ 35 /** <p> the child of this task instance </p>. */ 43 36 private ITaskInstance child; 44 37 … … 46 39 * <p> 47 40 * initializes this instance with the respective task model 48 * </p> 41 * </p>. 49 42 * 50 * @param task 51 * the task of which this is an instance 43 * @param task the task of which this is an instance 52 44 */ 53 45 SelectionInstance(ITask task) { … … 95 87 * <p> 96 88 * used to set the child of this task instance 97 * </p> 98 * 99 * @param child 100 * the new child of this instance 89 * </p>. 90 * 91 * @param child the new child of this instance 101 92 */ 102 93 void setChild(ITaskInstance child) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Sequence.java
r1733 r1734 17 17 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 18 18 19 // TODO: Auto-generated Javadoc 19 20 /** 20 21 * <p> … … 27 28 class Sequence extends StructuringTemporalRelationship implements ISequence { 28 29 29 /** 30 * <p> 31 * default serial version UID 32 * </p> 33 */ 30 /** <p> default serial version UID </p>. */ 34 31 private static final long serialVersionUID = 1L; 35 32 … … 38 35 * simple constructor providing the base class with a human readable name of 39 36 * the type of this task 40 * </p> 37 * </p>. 41 38 */ 42 39 Sequence() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/SequenceInstance.java
r1733 r1734 25 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 26 26 27 // TODO: Auto-generated Javadoc 27 28 /** 28 29 * <p> … … 34 35 class SequenceInstance extends TaskInstance implements ISequenceInstance { 35 36 36 /** 37 * <p> 38 * default serial version UID 39 * </p> 40 */ 37 /** <p> default serial version UID </p>. */ 41 38 private static final long serialVersionUID = 1L; 42 39 43 /** 44 * <p> 45 * the children of this task instance which are task instances, as well 46 * </p> 47 */ 40 /** <p> the children of this task instance which are task instances, as well </p>. */ 48 41 private List<ITaskInstance> children; 49 42 … … 51 44 * <p> 52 45 * initializes this instance with the respective task model 53 * </p> 46 * </p>. 54 47 * 55 * @param task 56 * the task of which this is an instance 48 * @param task the task of which this is an instance 57 49 */ 58 50 SequenceInstance(ISequence task) { … … 63 55 * <p> 64 56 * used to add a child to this task instance at a specific position 65 * </p> 66 * 67 * @param index 68 * the position of the new child in the list of children 69 * @param child 70 * the new child of this instance 57 * </p>. 58 * 59 * @param index the position of the new child in the list of children 60 * @param child the new child of this instance 71 61 */ 72 62 synchronized void addChild(int index, ITaskInstance child) { … … 81 71 * <p> 82 72 * used to add a child to this task instance 83 * </p> 84 * 85 * @param child 86 * the new child of this instance 73 * </p>. 74 * 75 * @param child the new child of this instance 87 76 */ 88 77 synchronized void addChild(ITaskInstance child) { … … 133 122 * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance#getChildren() 134 123 */ 124 /** 125 * Gets the children. 126 * 127 * @return the children 128 */ 135 129 public synchronized List<ITaskInstance> getChildren() { 136 130 if (children == null) { … … 165 159 * <p> 166 160 * removes a child from this task instance at a specific position 167 * </p> 168 * 169 * @param index 170 * the position of the child to be removed 171 * 161 * </p>. 162 * 163 * @param index the position of the child to be removed 172 164 * @return the child removed from the children of this instance 173 165 */ -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/StructuringTemporalRelationship.java
r1733 r1734 21 21 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 22 22 23 // TODO: Auto-generated Javadoc 23 24 /** 24 25 * <p> … … 33 34 IStructuringTemporalRelationship { 34 35 35 /** 36 * <p> 37 * default serial version UID 38 * </p> 39 */ 36 /** <p> default serial version UID </p>. */ 40 37 private static final long serialVersionUID = 1L; 41 38 42 /** 43 * <p> 44 * the list of children of this temporal relationship 45 * </p> 46 */ 39 /** <p> the list of children of this temporal relationship </p>. */ 47 40 private List<ITask> children = new LinkedList<ITask>(); 48 41 … … 50 43 * <p> 51 44 * initializes this temporal relationship with a human readable name 52 * </p> 45 * </p>. 53 46 * 54 * @param relationshipType 55 * the human readable name of this temporal relationship 47 * @param relationshipType the human readable name of this temporal relationship 56 48 */ 57 49 StructuringTemporalRelationship(String relationshipType) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Task.java
r1733 r1734 30 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 31 31 32 // TODO: Auto-generated Javadoc 32 33 /** 33 34 * <p> … … 58 59 } 59 60 60 /** 61 * <p> 62 * default serial version UID 63 * </p> 64 */ 61 /** <p> default serial version UID </p>. */ 65 62 private static final long serialVersionUID = 1L; 66 63 … … 81 78 private final int id; 82 79 83 /** 84 * <p> 85 * a human readable type of the task (used for visualization purposes) 86 * </p> 87 */ 80 /** <p> a human readable type of the task (used for visualization purposes) </p>. */ 88 81 private final String type; 89 82 90 /** 91 * <p> 92 * a human readable description of the task 93 * </p> 94 */ 83 /** <p> a human readable description of the task </p>. */ 95 84 private String description; 96 85 97 /** 98 * <p> 99 * the instances of this task 100 * </p> 101 */ 86 /** <p> the instances of this task </p>. */ 102 87 private final Collection<ITaskInstance> instances = new HashSet<ITaskInstance>(); 103 88 104 /** 105 * <p> 106 * the execution variants of this task 107 * </p> 108 */ 89 /** <p> the execution variants of this task </p>. */ 109 90 private Collection<Collection<ITaskInstance>> executionVariants; 110 91 … … 114 95 * {@link #getNewId()} method 115 96 * </p> 116 * 117 * @param type 118 * the human readable type of the task 119 * 120 * @throws IllegalArgumentException 121 * in the case the provided type is null 97 * 98 * @param type the human readable type of the task 122 99 */ 123 100 Task(String type) { … … 143 120 * <p> 144 121 * internally used to add an instance to this task 145 * </p> 146 * 147 * @param instance 148 * the instance belonging to this task 122 * </p>. 123 * 124 * @param instance the instance belonging to this task 149 125 */ 150 126 synchronized void addInstance(ITaskInstance instance) { … … 172 148 173 149 /** 174 * 150 * Determine execution variants. 151 * 152 * @param executionVariants the execution variants 175 153 */ 176 154 private void determineExecutionVariants( … … 273 251 274 252 /** 275 * 253 * Checks if is same execution. 254 * 255 * @param instance1 the instance1 256 * @param instance2 the instance2 257 * @return true, if is same execution 276 258 */ 277 259 private boolean isSameExecution(ITaskInstance instance1, … … 327 309 328 310 /** 329 * 311 * Checks if is same execution list. 312 * 313 * @param list1 the list1 314 * @param list2 the list2 315 * @return true, if is same execution list 330 316 */ 331 317 private boolean isSameExecutionList(ITaskInstanceList list1, … … 347 333 * <p> 348 334 * internally used to remove an instance from this task 349 * </p> 350 * 351 * @param instance 352 * the instance to be removed from this task 335 * </p>. 336 * 337 * @param instance the instance to be removed from this task 353 338 */ 354 339 synchronized void removeInstance(ITaskInstance instance) { … … 360 345 * <p> 361 346 * internally used to set the human readable description of the task 362 * </p> 363 * 364 * @param description 365 * the new human readable description of the task 347 * </p>. 348 * 349 * @param description the new human readable description of the task 366 350 */ 367 351 void setDescription(String description) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskBuilder.java
r1733 r1734 33 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 34 34 35 // TODO: Auto-generated Javadoc 35 36 /** 36 37 * <p> … … 51 52 * @see ITaskBuilder#addChild(IIterationInstance, int, ITaskInstance) 52 53 */ 54 /** 55 * Adds the child. 56 * 57 * @param instance the instance 58 * @param index the index 59 * @param child the child 60 * @throws IllegalArgumentException the illegal argument exception 61 */ 53 62 public void addChild(IIterationInstance instance, int index, 54 63 ITaskInstance child) throws IllegalArgumentException { … … 170 179 * 171 180 * @see ITaskBuilder#addChild(ISequenceInstance, int, ITaskInstance) 181 */ 182 /** 183 * Adds the child. 184 * 185 * @param instance the instance 186 * @param index the index 187 * @param child the child 188 * @throws IllegalArgumentException the illegal argument exception 172 189 */ 173 190 public void addChild(ISequenceInstance instance, int index, … … 247 264 * relationship including a check for the child type. 248 265 * </p> 266 * 267 * @param parent the parent 268 * @param index the index 269 * @param child the child 249 270 */ 250 271 private void addChildInternal(StructuringTemporalRelationship parent, … … 266 287 * 267 288 * @see ITaskBuilder#addExecutedTask(IUserSession, int, ITaskInstance) 289 */ 290 /** 291 * Adds the executed task. 292 * 293 * @param session the session 294 * @param index the index 295 * @param taskInstance the task instance 268 296 */ 269 297 public void addExecutedTask(IUserSession session, int index, -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskFactory.java
r1733 r1734 32 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 33 33 34 // TODO: Auto-generated Javadoc 34 35 /** 35 36 * <p> -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskInfo.java
r1733 r1734 22 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric; 23 23 24 // TODO: Auto-generated Javadoc 24 25 /** 25 26 * <p> … … 42 43 private static class Measure implements IMeasure { 43 44 44 /** 45 * <p> 46 * the metric to which the measure belongs 47 * </p> 48 */ 45 /** <p> the metric to which the measure belongs </p>. */ 49 46 private final TaskMetric metric; 50 47 51 /** 52 * <p> 53 * the observed values for the difference contexts of the task 54 * </p> 55 */ 48 /** <p> the observed values for the difference contexts of the task </p>. */ 56 49 private HashMap<ITask, Integer> values; 57 50 58 /** 59 * <p> 60 * the context free value of the measure independent of the task context 61 * </p> 62 */ 51 /** <p> the context free value of the measure independent of the task context </p>. */ 63 52 private int contextFreeValue = 0; 64 53 … … 66 55 * <p> 67 56 * initializes the measure with a specific metric 68 * </p> 57 * </p>. 58 * 59 * @param metric the metric 69 60 */ 70 61 private Measure(TaskMetric metric) { … … 119 110 * increases the value of the measure context free as well as specific 120 111 * to the provided context according to the provided increment 121 * </p> 112 * </p>. 113 * 114 * @param context the context 115 * @param increment the increment 122 116 */ 123 117 private void increase(ITask context, int increment) { … … 143 137 * sets the value of the measure context free as well as specific to the 144 138 * provided context 145 * </p> 139 * </p>. 140 * 141 * @param context the context 142 * @param value the value 146 143 */ 147 144 private void set(ITask context, int value) { … … 159 156 } 160 157 161 /** 162 * <p> 163 * the task to which the infos belong 164 * </p> 165 */ 158 /** <p> the task to which the infos belong </p>. */ 166 159 private final ITask task; 167 160 168 /** 169 * <p> 170 * all available measures for the task 171 * </p> 172 */ 161 /** <p> all available measures for the task </p>. */ 173 162 private final ArrayList<Measure> measures = new ArrayList<Measure>(); 174 163 … … 177 166 * initialized the task infos with the task to which they belong. 178 167 * </p> 179 * 180 * @param task 168 * 169 * @param task the task 181 170 */ 182 171 TaskInfo(ITask task) { … … 209 198 * convenience method to internally determine the measure for a specific 210 199 * metric 211 * </p> 200 * </p>. 201 * 202 * @param metric the metric 203 * @return the measure 212 204 */ 213 205 private Measure getMeasure(TaskMetric metric) { … … 282 274 * increases a specific value for a measure of a specific metric in the 283 275 * provided context of the task 284 * </p> 285 * 286 * @param metric 287 * the metric to which the value belongs 288 * @param context 289 * the context of the task in which the measure was recorded 290 * @param increment 291 * the increment to be added to the value of the measure 276 * </p>. 277 * 278 * @param metric the metric to which the value belongs 279 * @param context the context of the task in which the measure was recorded 280 * @param increment the increment to be added to the value of the measure 292 281 */ 293 282 void increaseCount(TaskMetric metric, ITask context, int increment) { … … 307 296 * sets a specific value for a measure of a specific metric in the provided 308 297 * context of the task 309 * </p> 310 * 311 * @param metric 312 * the metric to which the value belongs 313 * @param context 314 * the context of the task in which the measure was recorded 315 * @param value 316 * the value of the measure 298 * </p>. 299 * 300 * @param metric the metric to which the value belongs 301 * @param context the context of the task in which the measure was recorded 302 * @param value the value of the measure 317 303 */ 318 304 void setCount(TaskMetric metric, ITask context, int value) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskInstance.java
r1733 r1734 19 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceVisitor; 20 20 21 // TODO: Auto-generated Javadoc 21 22 /** 22 23 * <p> … … 47 48 } 48 49 49 /** 50 * <p> 51 * default serial version UID 52 * </p> 53 */ 50 /** <p> default serial version UID </p>. */ 54 51 private static final long serialVersionUID = 1L; 55 52 … … 62 59 private static int temporalId = 0; 63 60 64 /** 65 * <p> 66 * the task instantiated by this task instance 67 * </p> 68 */ 61 /** <p> the task instantiated by this task instance </p>. */ 69 62 private ITask task; 70 63 … … 83 76 * {@link #getNewId()}. 84 77 * </p> 78 * 79 * @param task the task 85 80 */ 86 81 TaskInstance(ITask task) { … … 156 151 * <p> 157 152 * used to update the task represented through this instance 158 * </p> 159 * 160 * @param task 161 * the task to set 153 * </p>. 154 * 155 * @param task the task to set 162 156 */ 163 157 void setTask(ITask task) { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskModel.java
r1733 r1734 40 40 import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric; 41 41 42 // TODO: Auto-generated Javadoc 42 43 /** 43 44 * <p> … … 63 64 private static class TaskModelIndex { 64 65 65 /** 66 * <p> 67 * the tasks contained in the user session belonging to the model as 68 * well as statistical infos about them 69 * </p> 70 */ 66 /** <p> the tasks contained in the user session belonging to the model as well as statistical infos about them </p>. */ 71 67 private final Map<ITask, TaskInfo> taskMap = new HashMap<ITask, TaskInfo>(); 72 68 … … 75 71 * internal convenience method to build the task model during 76 72 * initialization 77 * </p> 73 * </p>. 74 * 75 * @param task the task 76 * @param context the context 78 77 */ 79 78 private void ensureTaskInfo(ITask task, ITask context) { … … 101 100 * to the parameters. 102 101 * </p> 102 * 103 * @param task the task 104 * @param context the context 105 * @param eventTaskInstancesCovered the event task instances covered 106 * @param depth the depth 103 107 */ 104 108 private void ensureTaskInfo(ITask task, ITask context, … … 126 130 * <p> 127 131 * internal convenience method to calculate the maximum depth of a task 128 * </p> 132 * </p>. 133 * 134 * @param task the task 135 * @return the depth 129 136 */ 130 137 private int getDepth(ITask task) { … … 151 158 * called on initialization to fill the index with infos about the given 152 159 * task instance as well as to calculate the appropriate metrics 153 * </p> 160 * </p>. 161 * 162 * @param taskInstance the task instance 163 * @param context the context 164 * @return the int[] 154 165 */ 155 166 private int[] handleTaskInstance(ITaskInstance taskInstance, … … 235 246 } 236 247 237 /** 238 * <p> 239 * default serial version UID 240 * </p> 241 */ 248 /** <p> default serial version UID </p>. */ 242 249 private static final long serialVersionUID = 1L; 243 250 244 /** 245 * <p> 246 * all metrics calculated by this type of task model 247 * </p> 248 */ 251 /** <p> all metrics calculated by this type of task model </p>. */ 249 252 private static final TaskMetric[] taskMetrics = new TaskMetric[] { 250 253 TaskMetric.COUNT, TaskMetric.DEPTH, TaskMetric.EVENT_COVERAGE, 251 254 TaskMetric.EVENT_COVERAGE_RATIO, TaskMetric.EVENT_COVERAGE_QUANTILE }; 252 255 253 /** 254 * <p> 255 * the user sessions belonging to the model 256 * </p> 257 */ 256 /** <p> the user sessions belonging to the model </p>. */ 258 257 private final List<IUserSession> userSessions; 259 258 260 /** 261 * <p> 262 * index for effectively accessing the model and calculating statistics 263 * about it 264 * </p> 265 */ 259 /** <p> index for effectively accessing the model and calculating statistics about it </p>. */ 266 260 private transient TaskModelIndex index = null; 267 261 … … 270 264 * initializes the task model with the user sessions out of which the tasks 271 265 * are extracted 272 * </p> 273 * 274 * @param userSessions 275 * as described 266 * </p>. 267 * 268 * @param userSessions as described 276 269 */ 277 270 TaskModel(List<IUserSession> userSessions) { … … 297 290 * internal convenience method that initializes the internal index and 298 291 * calculates all measures for metrics available for the tasks 299 * </p> 292 * </p>. 300 293 */ 301 294 private synchronized void ensureInitialized() { -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/UserSession.java
r1733 r1734 24 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 25 25 26 // TODO: Auto-generated Javadoc 26 27 /** 27 28 * <p> … … 34 35 class UserSession implements IUserSession { 35 36 36 /** 37 * <p> 38 * default serial version UID 39 * </p> 40 */ 37 /** <p> default serial version UID </p>. */ 41 38 private static final long serialVersionUID = 1L; 42 39 43 /** 44 * <p> 45 * the task instances belonging to the user session 46 * </p> 47 */ 40 /** <p> the task instances belonging to the user session </p>. */ 48 41 private List<ITaskInstance> executedTasks = new ArrayList<ITaskInstance>(); 49 42 … … 52 45 * used internally to add a task instance to the user session at a specific 53 46 * position 54 * </p> 55 * 56 * @param index 57 * the index the task instance shall be added to 58 * @param taskInstance 59 * the task instance to be added 47 * </p>. 48 * 49 * @param index the index the task instance shall be added to 50 * @param taskInstance the task instance to be added 60 51 */ 61 52 void addExecutedTask(int index, ITaskInstance taskInstance) { … … 66 57 * <p> 67 58 * used internally to add a task instance to the user session 68 * </p> 69 * 70 * @param taskInstance 71 * the task instance to be added 59 * </p>. 60 * 61 * @param taskInstance the task instance to be added 72 62 */ 73 63 void addExecutedTask(ITaskInstance taskInstance) { … … 159 149 * <p> 160 150 * used internally to remove a task instance from the user session 161 * </p> 162 * 163 * @param index 164 * the index of the task instance to be removed 151 * </p>. 152 * 153 * @param index the index of the task instance to be removed 165 154 */ 166 155 void removeExecutedTask(int index) {
Note: See TracChangeset
for help on using the changeset viewer.