Changeset 1734


Ignore:
Timestamp:
09/05/14 20:20:29 (10 years ago)
Author:
rkrimmel
Message:

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

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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
    36import java.util.ArrayList; 
    47 
     8// TODO: Auto-generated Javadoc 
     9/** 
     10 * The Class Alignment. 
     11 */ 
    512public class Alignment { 
     13         
     14        /** The alingment. */ 
    615        ArrayList<NumberSequence> alingment; 
    716 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithm.java

    r1733 r1734  
     1/* 
     2 *  
     3 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     
    58import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 
    69 
     10// TODO: Auto-generated Javadoc 
     11/** 
     12 * The Interface AlignmentAlgorithm. 
     13 */ 
    714public interface AlignmentAlgorithm { 
    815 
     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         */ 
    924        void align(NumberSequence input1, NumberSequence input2, 
    1025                        SubstitutionMatrix submat, float threshold); 
    1126 
     27        /** 
     28         * Gets the alignment. 
     29         * 
     30         * @return the alignment 
     31         */ 
    1232        public abstract ArrayList<NumberSequence> getAlignment(); 
    1333 
    1434        /** 
    1535         * Get the alignment score between the two input strings. 
     36         * 
     37         * @return the alignment score 
    1638         */ 
    1739        public abstract double getAlignmentScore(); 
    1840 
     41        /** 
     42         * Gets the matches. 
     43         * 
     44         * @return the matches 
     45         */ 
    1946        public abstract ArrayList<Match> getMatches(); 
    2047 
     48        /** 
     49         * Gets the max score. 
     50         * 
     51         * @return the max score 
     52         */ 
    2153        public double getMaxScore(); 
    2254 
     55        /** 
     56         * Prints the alignment. 
     57         */ 
    2358        public abstract void printAlignment(); 
    2459 
     60        /** 
     61         * Prints the dp matrix. 
     62         */ 
    2563        public abstract void printDPMatrix(); 
    2664 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java

    r1733 r1734  
     1/* 
     2 *  
     3 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     6// TODO: Auto-generated Javadoc 
     7/** 
     8 * A factory for creating AlignmentAlgorithm objects. 
     9 */ 
    310public class AlignmentAlgorithmFactory { 
    411 
     12        /** 
     13         * Creates the. 
     14         * 
     15         * @return the alignment algorithm 
     16         */ 
    517        public static AlignmentAlgorithm create() { 
    618                Class<?> newclass; 
     
    1830        } 
    1931 
     32        /** 
     33         * Sets the default algorithm. 
     34         * 
     35         * @param algorithmname the new default algorithm 
     36         */ 
    2037        public static void setDefaultAlgorithm(String algorithmname) { 
    2138                // TODO: check for valid algorihm class names here 
     
    2340        } 
    2441 
     42        /** The algorithmclass. */ 
    2543        private static String algorithmclass = "de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated"; 
    2644} 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentHelpers.java

    r1733 r1734  
     1/* 
     2 *  
     3 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     
    710import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 
    811 
     12// TODO: Auto-generated Javadoc 
     13/** 
     14 * The Class AlignmentHelpers. 
     15 */ 
    916public class AlignmentHelpers extends GUIModel { 
    1017 
     18        /** 
     19         * Distance between. 
     20         * 
     21         * @param first the first 
     22         * @param second the second 
     23         * @return the int 
     24         */ 
    1125        public static int distanceBetween(IGUIElement first, IGUIElement second) { 
    1226 
     
    3751         * in the list. If there is no common denominator, the method returns null. 
    3852         * </p> 
     53         * 
     54         * @param guiElements the gui elements 
     55         * @return the common denominator 
    3956         */ 
    4057        private static IGUIElement getCommonDenominator( 
     
    99116        } 
    100117 
    101         /** 
    102          *  
    103          */ 
     118        /** The Constant serialVersionUID. */ 
    104119        private static final long serialVersionUID = -2593092958275693133L; 
    105120 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Constants.java

    r1733 r1734  
     1/* 
     2 *  
     3 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     6// TODO: Auto-generated Javadoc 
     7/** 
     8 * The Class Constants. 
     9 */ 
    310public class Constants { 
    411 
     12        /** The Constant GAP_SYMBOL. */ 
    513        public static final int GAP_SYMBOL = -1; 
     14         
     15        /** The Constant UNMATCHED_SYMBOL. */ 
    616        public static final int UNMATCHED_SYMBOL = -2; 
    717 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Match.java

    r1733 r1734  
     1/* 
     2 *  
     3 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     
    58import java.util.LinkedList; 
    69 
     10// TODO: Auto-generated Javadoc 
     11/** 
     12 * The Class Match. 
     13 */ 
    714public class Match implements Serializable { 
    8         /** 
    9          *  
    10          */ 
     15         
     16        /** The Constant serialVersionUID. */ 
    1117        private static final long serialVersionUID = -3206992723755714741L; 
    1218 
     19        /** The matchseqs. */ 
    1320        private final ArrayList<NumberSequence> matchseqs; 
    1421 
     22        /** The occurences. */ 
    1523        private LinkedList<MatchOccurence> occurences; 
    1624 
     25        /** 
     26         * Instantiates a new match. 
     27         */ 
    1728        public Match() { 
    1829                matchseqs = new ArrayList<NumberSequence>(2); 
     
    2233        } 
    2334 
     35        /** 
     36         * Adds the occurence. 
     37         * 
     38         * @param occurence the occurence 
     39         */ 
    2440        public void addOccurence(MatchOccurence occurence) { 
    2541                occurences.add(occurence); 
    2642        } 
    2743 
     44        /** 
     45         * Adds the occurences of. 
     46         * 
     47         * @param m the m 
     48         */ 
    2849        public void addOccurencesOf(Match m) { 
    2950                occurences.addAll(m.getOccurences()); 
    3051        } 
    3152 
     53        /** 
     54         * Equals. 
     55         * 
     56         * @param m the m 
     57         * @return true, if successful 
     58         */ 
    3259        public boolean equals(Match m) { 
    3360                if ((m.getFirstSequence().equals(this.getFirstSequence()) || m 
     
    4067        } 
    4168 
     69        /** 
     70         * Gets the first sequence. 
     71         * 
     72         * @return the first sequence 
     73         */ 
    4274        public NumberSequence getFirstSequence() { 
    4375                return matchseqs.get(0); 
    4476        } 
    4577 
     78        /** 
     79         * Gets the occurences. 
     80         * 
     81         * @return the occurences 
     82         */ 
    4683        public LinkedList<MatchOccurence> getOccurences() { 
    4784                return occurences; 
    4885        } 
    4986 
     87        /** 
     88         * Gets the second sequence. 
     89         * 
     90         * @return the second sequence 
     91         */ 
    5092        public NumberSequence getSecondSequence() { 
    5193                return matchseqs.get(1); 
    5294        } 
    5395 
     96        /** 
     97         * Occurence count. 
     98         * 
     99         * @return the int 
     100         */ 
    54101        public int occurenceCount() { 
    55102                return occurences.size(); 
    56103        } 
    57104 
     105        /** 
     106         * Sets the first sequence. 
     107         * 
     108         * @param seq the new first sequence 
     109         */ 
    58110        public void setFirstSequence(NumberSequence seq) { 
    59111                matchseqs.set(0, seq); 
    60112        } 
    61113 
     114        /** 
     115         * Sets the occurences. 
     116         * 
     117         * @param occurences the new occurences 
     118         */ 
    62119        public void setOccurences(LinkedList<MatchOccurence> occurences) { 
    63120                this.occurences = occurences; 
    64121        } 
    65122 
     123        /** 
     124         * Sets the second sequence. 
     125         * 
     126         * @param seq the new second sequence 
     127         */ 
    66128        public void setSecondSequence(NumberSequence seq) { 
    67129                matchseqs.set(1, seq); 
    68130        } 
    69131 
     132        /** 
     133         * Size. 
     134         * 
     135         * @return the int 
     136         */ 
    70137        public int size() { 
    71138                // 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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
    36import java.io.Serializable; 
    47 
     8// TODO: Auto-generated Javadoc 
     9/** 
     10 * The Class MatchOccurence. 
     11 */ 
    512public class MatchOccurence implements Serializable { 
    6         /** 
    7          *  
    8          */ 
     13         
     14        /** The Constant serialVersionUID. */ 
    915        private static final long serialVersionUID = 6186633243145293781L; 
     16         
     17        /** The startindex. */ 
    1018        private int startindex; 
     19         
     20        /** The endindex. */ 
    1121        private int endindex; 
     22         
     23        /** The sequence id. */ 
    1224        private int sequenceId; 
    1325 
     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         */ 
    1433        public MatchOccurence(int startindex, int endindex, int sequenceId) { 
    1534                this.startindex = startindex; 
     
    1837        } 
    1938 
     39        /** 
     40         * Gets the endindex. 
     41         * 
     42         * @return the endindex 
     43         */ 
    2044        public int getEndindex() { 
    2145                return endindex; 
    2246        } 
    2347 
     48        /** 
     49         * Gets the sequence id. 
     50         * 
     51         * @return the sequence id 
     52         */ 
    2453        public int getSequenceId() { 
    2554                return sequenceId; 
    2655        } 
    2756 
     57        /** 
     58         * Gets the startindex. 
     59         * 
     60         * @return the startindex 
     61         */ 
    2862        public int getStartindex() { 
    2963                return startindex; 
    3064        } 
    3165 
     66        /** 
     67         * Sets the endindex. 
     68         * 
     69         * @param endindex the new endindex 
     70         */ 
    3271        public void setEndindex(int endindex) { 
    3372                this.endindex = endindex; 
    3473        } 
    3574 
     75        /** 
     76         * Sets the sequence id. 
     77         * 
     78         * @param sequenceId the new sequence id 
     79         */ 
    3680        public void setSequenceId(int sequenceId) { 
    3781                this.sequenceId = sequenceId; 
    3882        } 
    3983 
     84        /** 
     85         * Sets the startindex. 
     86         * 
     87         * @param startindex the new startindex 
     88         */ 
    4089        public void setStartindex(int startindex) { 
    4190                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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     6// TODO: Auto-generated Javadoc 
     7/** 
     8 * The Class MatrixEntry. 
     9 */ 
    310public class MatrixEntry { 
     11         
     12        /** The score. */ 
    413        private double score; 
     14         
     15        /** The previous. */ 
    516        private MatrixEntry previous; 
     17         
     18        /** The xvalue. */ 
    619        private int xvalue; 
     20         
     21        /** The yvalue. */ 
    722        private int yvalue; 
    823 
     24        /** 
     25         * Instantiates a new matrix entry. 
     26         */ 
    927        public MatrixEntry() { 
    1028        } 
    1129 
     30        /** 
     31         * Instantiates a new matrix entry. 
     32         * 
     33         * @param score the score 
     34         * @param previous the previous 
     35         */ 
    1236        public MatrixEntry(float score, MatrixEntry previous) { 
    1337                this.score = score; 
     
    1539        } 
    1640 
     41        /** 
     42         * Gets the previous. 
     43         * 
     44         * @return the previous 
     45         */ 
    1746        public MatrixEntry getPrevious() { 
    1847                return previous; 
    1948        } 
    2049 
     50        /** 
     51         * Gets the score. 
     52         * 
     53         * @return the score 
     54         */ 
    2155        public double getScore() { 
    2256                return score; 
    2357        } 
    2458 
     59        /** 
     60         * Gets the xvalue. 
     61         * 
     62         * @return the xvalue 
     63         */ 
    2564        public int getXvalue() { 
    2665                return xvalue; 
    2766        } 
    2867 
     68        /** 
     69         * Gets the yvalue. 
     70         * 
     71         * @return the yvalue 
     72         */ 
    2973        public int getYvalue() { 
    3074                return yvalue; 
    3175        } 
    3276 
     77        /** 
     78         * Sets the previous. 
     79         * 
     80         * @param previous the new previous 
     81         */ 
    3382        public void setPrevious(MatrixEntry previous) { 
    3483                this.previous = previous; 
    3584        } 
    3685 
     86        /** 
     87         * Sets the score. 
     88         * 
     89         * @param score the new score 
     90         */ 
    3791        public void setScore(double score) { 
    3892                this.score = score; 
    3993        } 
    4094 
     95        /** 
     96         * Sets the xvalue. 
     97         * 
     98         * @param xvalue the new xvalue 
     99         */ 
    41100        public void setXvalue(int xvalue) { 
    42101                this.xvalue = xvalue; 
    43102        } 
    44103 
     104        /** 
     105         * Sets the yvalue. 
     106         * 
     107         * @param yvalue the new yvalue 
     108         */ 
    45109        public void setYvalue(int yvalue) { 
    46110                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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     
    811import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 
    912 
     13// TODO: Auto-generated Javadoc 
     14/** 
     15 * The Class NeedlemanWunsch. 
     16 */ 
    1017public class NeedlemanWunsch implements AlignmentAlgorithm { 
    1118 
    12         /** 
    13          * The first input 
    14          */ 
     19        /** The first input. */ 
    1520        private int[] input1; 
    1621 
    17         /** 
    18          * The second input String 
    19          */ 
     22        /** The second input String. */ 
    2023        private int[] input2; 
    2124 
    22         /** 
    23          * The lengths of the input 
    24          */ 
     25        /** The lengths of the input. */ 
    2526        private int length1, length2; 
    2627 
     
    3132        private MatrixEntry[][] matrix; 
    3233 
     34        /** The alignment. */ 
    3335        private ArrayList<NumberSequence> alignment; 
    3436 
    35         /** 
    36          * Substitution matrix to calculate scores 
    37          */ 
     37        /** Substitution matrix to calculate scores. */ 
    3838        private SubstitutionMatrix submat; 
    3939 
     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         */ 
    4043        @Override 
    4144        public void align(NumberSequence input1, NumberSequence input2, 
     
    155158        } 
    156159 
     160        /* (non-Javadoc) 
     161         * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getMatches() 
     162         */ 
    157163        @Override 
    158164        public ArrayList<Match> getMatches() { 
     
    163169        /** 
    164170         * Get the maximum value in the score matrix. 
     171         * 
     172         * @return the max score 
    165173         */ 
    166174        @Override 
     
    180188        } 
    181189 
     190        /* (non-Javadoc) 
     191         * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#printAlignment() 
     192         */ 
    182193        @Override 
    183194        public void printAlignment() { 
     
    210221 
    211222        /** 
    212          * print the dynmaic programming matrix 
     223         * print the dynmaic programming matrix. 
    213224         */ 
    214225        @Override 
     
    232243        } 
    233244 
     245        /** 
     246         * Sets the alignment. 
     247         * 
     248         * @param alignment the new alignment 
     249         */ 
    234250        public void setAlignment(ArrayList<NumberSequence> alignment) { 
    235251                this.alignment = alignment; 
     
    250266        } 
    251267 
     268        /** 
     269         * Traceback. 
     270         */ 
    252271        public void traceback() { 
    253272                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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     
    58import java.util.Random; 
    69 
     10// TODO: Auto-generated Javadoc 
     11/** 
     12 * The Class NumberSequence. 
     13 */ 
    714public class NumberSequence implements Serializable { 
    8         /** 
    9          *  
    10          */ 
     15         
     16        /** The Constant serialVersionUID. */ 
    1117        private static final long serialVersionUID = -4604570107534055589L; 
     18         
     19        /** The sequence. */ 
    1220        private int[] sequence; 
     21         
     22        /** The id. */ 
    1323        private int id; 
    1424 
     25        /** 
     26         * Instantiates a new number sequence. 
     27         * 
     28         * @param size the size 
     29         */ 
    1530        public NumberSequence(int size) { 
    1631 
     
    1934 
    2035        // Searching occurrences of pattern 
     36        /** 
     37         * Contains pattern. 
     38         * 
     39         * @param pattern the pattern 
     40         * @return the linked list 
     41         */ 
    2142        public LinkedList<Integer> containsPattern(Match pattern) { 
    2243                final LinkedList<Integer> result = new LinkedList<Integer>(); 
     
    3455        } 
    3556 
     57        /** 
     58         * Equals. 
     59         * 
     60         * @param n the n 
     61         * @return true, if successful 
     62         */ 
    3663        public boolean equals(NumberSequence n) { 
    3764                final int[] seq = n.getSequence(); 
     
    4875 
    4976        // 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         */ 
    5083        public int eventCount(int event) { 
    5184                int count = 0; 
     
    5891        } 
    5992 
     93        /** 
     94         * Gets the id. 
     95         * 
     96         * @return the id 
     97         */ 
    6098        public int getId() { 
    6199                return id; 
    62100        } 
    63101 
     102        /** 
     103         * Gets the sequence. 
     104         * 
     105         * @return the sequence 
     106         */ 
    64107        public int[] getSequence() { 
    65108                return sequence; 
     
    67110 
    68111        // 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         */ 
    69127        private boolean matches(int i, int[] p1, int[] p2, int ip1, int ip2, 
    70128                        boolean jumped1, // True if there was a gap in Sequence 1 of the 
     
    134192        } 
    135193 
     194        /** 
     195         * Prints the sequence. 
     196         */ 
    136197        public void printSequence() { 
    137198                for (int i = 0; i < sequence.length; i++) { 
     
    141202        } 
    142203 
     204        /** 
     205         * Sets the id. 
     206         * 
     207         * @param id the new id 
     208         */ 
    143209        public void setId(int id) { 
    144210                this.id = id; 
    145211        } 
    146212 
     213        /** 
     214         * Sets the sequence. 
     215         * 
     216         * @param sequence the new sequence 
     217         */ 
    147218        public void setSequence(int[] sequence) { 
    148219                this.sequence = sequence; 
    149220        } 
    150221 
     222        /** 
     223         * Shuffle. 
     224         * 
     225         * @return the number sequence 
     226         */ 
    151227        public NumberSequence shuffle() { 
    152228                final NumberSequence result = new NumberSequence(sequence.length); 
     
    165241        } 
    166242 
     243        /** 
     244         * Size. 
     245         * 
     246         * @return the int 
     247         */ 
    167248        public int size() { 
    168249                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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     
    811import de.ugoe.cs.util.console.Console; 
    912 
     13// TODO: Auto-generated Javadoc 
     14/** 
     15 * The Class SmithWaterman. 
     16 */ 
    1017public class SmithWaterman implements AlignmentAlgorithm { 
    1118 
    12         /** 
    13          * The first input 
    14          */ 
     19        /** The first input. */ 
    1520        private int[] input1; 
    1621 
    17         /** 
    18          * The second input String 
    19          */ 
     22        /** The second input String. */ 
    2023        private int[] input2; 
    2124 
    22         /** 
    23          * The lengths of the input 
    24          */ 
     25        /** The lengths of the input. */ 
    2526        private int length1, length2; 
    2627 
     
    3132        private MatrixEntry[][] matrix; 
    3233 
     34        /** The alignment. */ 
    3335        private ArrayList<NumberSequence> alignment; 
    3436 
    35         /** 
    36          * Substitution matrix to calculate scores 
    37          */ 
     37        /** Substitution matrix to calculate scores. */ 
    3838        private SubstitutionMatrix submat; 
    3939 
     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         */ 
    4043        @Override 
    4144        public void align(NumberSequence input1, NumberSequence input2, 
     
    163166        } 
    164167 
     168        /* (non-Javadoc) 
     169         * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getMatches() 
     170         */ 
    165171        @Override 
    166172        public ArrayList<Match> getMatches() { 
     
    171177        /** 
    172178         * Get the maximum value in the score matrix. 
     179         * 
     180         * @return the max score 
    173181         */ 
    174182        @Override 
     
    188196        } 
    189197 
     198        /* (non-Javadoc) 
     199         * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#printAlignment() 
     200         */ 
    190201        @Override 
    191202        public void printAlignment() { 
     
    223234 
    224235        /** 
    225          * print the dynmaic programming matrix 
     236         * print the dynmaic programming matrix. 
    226237         */ 
    227238        @Override 
     
    245256        } 
    246257 
     258        /** 
     259         * Sets the alignment. 
     260         * 
     261         * @param alignment the new alignment 
     262         */ 
    247263        public void setAlignment(ArrayList<NumberSequence> alignment) { 
    248264                this.alignment = alignment; 
     
    263279        } 
    264280 
     281        /** 
     282         * Traceback. 
     283         */ 
    265284        public void traceback() { 
    266285                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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
    25 
     
    811import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Constants; 
    912 
     13// TODO: Auto-generated Javadoc 
     14/** 
     15 * The Class SmithWatermanRepeated. 
     16 */ 
    1017public class SmithWatermanRepeated implements AlignmentAlgorithm { 
    1118 
    12         /** 
    13          * The first input 
    14          */ 
     19        /** The first input. */ 
    1520        private int[] input1; 
    1621 
    17         /** 
    18          * The second input String 
    19          */ 
     22        /** The second input String. */ 
    2023        private int[] input2; 
    2124 
    22         /** 
    23          * The lengths of the input 
    24          */ 
     25        /** The lengths of the input. */ 
    2526        private int length1, length2; 
    2627 
     
    3132        private MatrixEntry[][] matrix; 
    3233 
     34        /** The alignment. */ 
    3335        private ArrayList<NumberSequence> alignment; 
    3436 
     37        /** The score threshold. */ 
    3538        private float scoreThreshold; 
    3639 
    37         /** 
    38          * Substitution matrix to calculate scores 
    39          */ 
     40        /** Substitution matrix to calculate scores. */ 
    4041        private SubstitutionMatrix submat; 
    4142 
     43        /** 
     44         * Instantiates a new smith waterman repeated. 
     45         */ 
    4246        public SmithWatermanRepeated() { 
    4347 
    4448        } 
    4549 
     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         */ 
    4653        @Override 
    4754        public void align(NumberSequence input1, NumberSequence input2, 
     
    219226        } 
    220227 
     228        /* (non-Javadoc) 
     229         * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#getMatches() 
     230         */ 
    221231        @Override 
    222232        public ArrayList<Match> getMatches() { 
     
    265275        /** 
    266276         * Get the maximum value in the score matrix. 
     277         * 
     278         * @return the max score 
    267279         */ 
    268280        @Override 
     
    282294        } 
    283295 
     296        /* (non-Javadoc) 
     297         * @see de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm#printAlignment() 
     298         */ 
    284299        @Override 
    285300        public void printAlignment() { 
     
    312327 
    313328        /** 
    314          * print the dynmaic programming matrix 
     329         * print the dynmaic programming matrix. 
    315330         */ 
    316331        @Override 
     
    337352        } 
    338353 
     354        /** 
     355         * Sets the alignment. 
     356         * 
     357         * @param alignment the new alignment 
     358         */ 
    339359        public void setAlignment(ArrayList<NumberSequence> alignment) { 
    340360                this.alignment = alignment; 
     
    355375        } 
    356376 
     377        /** 
     378         * Traceback. 
     379         */ 
    357380        public void traceback() { 
    358381                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  
    99import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    1010 
     11// TODO: Auto-generated Javadoc 
    1112/** 
     13 * The Class DifferenceSubstitutionMatrix. 
     14 * 
    1215 * @author Ralph Krimmel 
    13  * 
    1416 */ 
    1517public class DifferenceSubstitutionMatrix implements SubstitutionMatrix { 
    1618 
     19        /** The input1. */ 
    1720        private final int[] input1; 
     21         
     22        /** The input2. */ 
    1823        private final int[] input2; 
     24         
     25        /** The max value. */ 
    1926        private final int maxValue; 
    2027 
     28        /** 
     29         * Instantiates a new difference substitution matrix. 
     30         * 
     31         * @param input1 the input1 
     32         * @param input2 the input2 
     33         */ 
    2134        public DifferenceSubstitutionMatrix(int[] input1, int[] input2) { 
    2235                this.input1 = input1; 
     
    2538        } 
    2639 
     40        /* (non-Javadoc) 
     41         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 
     42         */ 
    2743        @Override 
    2844        public void generate(HashSet<ITask> uniqueTasks) { 
    2945        } 
    3046 
     47        /* (non-Javadoc) 
     48         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 
     49         */ 
    3150        @Override 
    3251        public float getGapPenalty() { 
     
    3453        } 
    3554 
     55        /** 
     56         * Gets the max value. 
     57         * 
     58         * @return the max value 
     59         */ 
    3660        private int getMaxValue() { 
    3761                int max = input1[0]; 
     
    6185        } 
    6286 
     87        /* (non-Javadoc) 
     88         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) 
     89         */ 
    6390        @Override 
    6491        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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
     
    69import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    710 
     11// TODO: Auto-generated Javadoc 
     12/** 
     13 * The Class DummySubstitutionMatrix. 
     14 */ 
    815public class DummySubstitutionMatrix implements SubstitutionMatrix { 
    916 
     17        /* (non-Javadoc) 
     18         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 
     19         */ 
    1020        @Override 
    1121        public void generate(HashSet<ITask> uniqueTasks) { 
    1222        } 
    1323 
     24        /* (non-Javadoc) 
     25         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 
     26         */ 
    1427        @Override 
    1528        public float getGapPenalty() { 
     
    1730        } 
    1831 
     32        /* (non-Javadoc) 
     33         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getScore(int, int) 
     34         */ 
    1935        @Override 
    2036        public float getScore(int pos1, int pos2) { 
     
    2642        } 
    2743 
     44        /* (non-Javadoc) 
     45         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) 
     46         */ 
    2847        @Override 
    2948        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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
    36import java.util.ArrayList; 
    47 
     8// TODO: Auto-generated Javadoc 
    59//Must be initialized! 
     10/** 
     11 * The Class DynamicTriangleMatrix. 
     12 */ 
    613public class DynamicTriangleMatrix implements ITriangleMatrix { 
    714 
     15        /** The matrix. */ 
    816        private final ArrayList<Float> matrix; 
     17         
     18        /** The size. */ 
    919        protected int size; 
     20         
     21        /** The initalization value. */ 
    1022        private float initalizationValue; 
    1123 
     24        /** 
     25         * Instantiates a new dynamic triangle matrix. 
     26         * 
     27         * @param size the size 
     28         */ 
    1229        public DynamicTriangleMatrix(int size) { 
    1330                this.size = size; 
     
    8198        } 
    8299 
     100        /* (non-Javadoc) 
     101         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#size() 
     102         */ 
    83103        @Override 
    84104        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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
     
    710import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    811 
     12// TODO: Auto-generated Javadoc 
     13/** 
     14 * The Class EventTaskInstancesListGenerator. 
     15 */ 
    916public class EventTaskInstancesListGenerator extends 
    1017                DefaultTaskTraversingVisitor { 
    1118 
     19        /** The eventlist. */ 
    1220        private LinkedList<IEventTaskInstance> eventlist; 
    1321 
     22        /** 
     23         * Instantiates a new event task instances list generator. 
     24         */ 
    1425        public EventTaskInstancesListGenerator() { 
    1526                eventlist = new LinkedList<IEventTaskInstance>(); 
    1627        } 
    1728 
     29        /** 
     30         * Gets the eventlist. 
     31         * 
     32         * @return the eventlist 
     33         */ 
    1834        public LinkedList<IEventTaskInstance> getEventlist() { 
    1935                return eventlist; 
    2036        } 
    2137 
     38        /** 
     39         * Sets the eventlist. 
     40         * 
     41         * @param eventlist the new eventlist 
     42         */ 
    2243        public void setEventlist(LinkedList<IEventTaskInstance> eventlist) { 
    2344                this.eventlist = eventlist; 
    2445        } 
    2546 
     47        /* (non-Javadoc) 
     48         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.DefaultTaskTraversingVisitor#visit(de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask) 
     49         */ 
    2650        @Override 
    2751        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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
     6// TODO: Auto-generated Javadoc 
     7/** 
     8 * The Interface ITriangleMatrix. 
     9 */ 
    310public interface ITriangleMatrix { 
    411 
     12        /** 
     13         * Gets the. 
     14         * 
     15         * @param first the first 
     16         * @param second the second 
     17         * @return the float 
     18         */ 
    519        public abstract float get(int first, int second); 
    620 
    721        // Increases the size 
     22        /** 
     23         * Increase size. 
     24         * 
     25         * @param count the count 
     26         * @throws Exception the exception 
     27         */ 
    828        public abstract void increaseSize(int count) throws Exception; 
    929 
     30        /** 
     31         * Initialize. 
     32         * 
     33         * @param value the value 
     34         */ 
    1035        public abstract void initialize(float value); 
    1136 
     37        /** 
     38         * Sets the. 
     39         * 
     40         * @param first the first 
     41         * @param second the second 
     42         * @param value the value 
     43         */ 
    1244        public abstract void set(int first, int second, float value); 
    1345 
     46        /** 
     47         * Size. 
     48         * 
     49         * @return the int 
     50         */ 
    1451        public abstract int size(); 
    1552 
     53        /** 
     54         * To string. 
     55         * 
     56         * @return the string 
     57         */ 
    1658        @Override 
    1759        public abstract String toString(); 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/NearbySubstitutionMatrix.java

    r1733 r1734  
    99import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    1010 
     11// TODO: Auto-generated Javadoc 
    1112/** 
     13 * The Class NearbySubstitutionMatrix. 
     14 * 
    1215 * @author Ralph Krimmel 
    13  * 
    1416 */ 
    1517public class NearbySubstitutionMatrix implements SubstitutionMatrix { 
    1618 
     19        /** The input1. */ 
    1720        private final int[] input1; 
     21         
     22        /** The input2. */ 
    1823        private final int[] input2; 
     24         
     25        /** The range. */ 
    1926        private final int range; 
    2027 
     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         */ 
    2135        public NearbySubstitutionMatrix(int[] input1, int[] input2, int range) { 
    2236                this.input1 = input1; 
     
    2539        } 
    2640 
     41        /* (non-Javadoc) 
     42         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 
     43         */ 
    2744        @Override 
    2845        public void generate(HashSet<ITask> uniqueTasks) { 
    2946        } 
    3047 
     48        /* (non-Javadoc) 
     49         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 
     50         */ 
    3151        @Override 
    3252        public float getGapPenalty() { 
     
    5171        } 
    5272 
     73        /* (non-Javadoc) 
     74         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#update(java.util.LinkedList) 
     75         */ 
    5376        @Override 
    5477        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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
     
    1720import de.ugoe.cs.util.console.Console; 
    1821 
     22// TODO: Auto-generated Javadoc 
     23/** 
     24 * The Class ObjectDistanceSubstitionMatrix. 
     25 */ 
    1926public class ObjectDistanceSubstitionMatrix implements SubstitutionMatrix, 
    2027                Serializable { 
    2128 
    22         /** 
    23          *  
    24          */ 
     29        /** The Constant serialVersionUID. */ 
    2530        private static final long serialVersionUID = -4253258274617754083L; 
     31         
     32        /** The idmapping. */ 
    2633        private final HashMap<Integer, Integer> idmapping; 
     34         
     35        /** The matrix. */ 
    2736        private ITriangleMatrix matrix; 
     37         
     38        /** The unique tasks. */ 
    2839        private HashSet<ITask> uniqueTasks; 
     40         
     41        /** The gap penalty. */ 
    2942        private float gapPenalty; 
     43         
     44        /** The index. */ 
    3045        private int index = 0; 
     46         
     47        /** The etis of tasks. */ 
    3148        private final HashMap<Integer, LinkedList<IEventTaskInstance>> etisOfTasks; 
     49         
     50        /** The calculate non task instances. */ 
    3251        private boolean calculateNonTaskInstances = true; 
     52         
     53        /** The first round max index. */ 
    3354        private int firstRoundMaxIndex = 0; 
    3455 
     56        /** The positive threshold. */ 
    3557        private final double positiveThreshold; 
    3658 
     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         */ 
    3766        public ObjectDistanceSubstitionMatrix(float positiveThreshold, 
    3867                        int gapPenalty, boolean calculateNonTaskInstances) { 
     
    4574        } 
    4675 
     76        /** 
     77         * Compute distance. 
     78         * 
     79         * @param task1 the task1 
     80         * @param task2 the task2 
     81         */ 
    4782        private void computeDistance(ITask task1, ITask task2) { 
    4883                int index1 = -1; 
     
    92127        } 
    93128 
     129        /** 
     130         * Distance between instances. 
     131         * 
     132         * @param eti1 the eti1 
     133         * @param eti2 the eti2 
     134         * @return the float 
     135         */ 
    94136        private float distanceBetweenInstances(IEventTaskInstance eti1, 
    95137                        IEventTaskInstance eti2) { 
     
    101143        } 
    102144 
     145        /** 
     146         * Distance between task and instance. 
     147         * 
     148         * @param task1 the task1 
     149         * @param eti1 the eti1 
     150         * @return the float 
     151         */ 
    103152        private float distanceBetweenTaskAndInstance(ITask task1, 
    104153                        IEventTaskInstance eti1) { 
     
    127176        } 
    128177 
     178        /** 
     179         * Distance between tasks. 
     180         * 
     181         * @param task1 the task1 
     182         * @param task2 the task2 
     183         * @return the float 
     184         */ 
    129185        private float distanceBetweenTasks(ITask task1, ITask task2) { 
    130186                if (this.calculateNonTaskInstances) { 
     
    144200        } 
    145201 
     202        /* (non-Javadoc) 
     203         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#generate(java.util.HashSet) 
     204         */ 
    146205        @Override 
    147206        public void generate(HashSet<ITask> uniqueTasks) { 
     
    174233        } 
    175234 
     235        /* (non-Javadoc) 
     236         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getGapPenalty() 
     237         */ 
    176238        @Override 
    177239        public float getGapPenalty() { 
     
    179241        } 
    180242 
     243        /** 
     244         * Gets the index. 
     245         * 
     246         * @param eti the eti 
     247         * @return the index 
     248         */ 
    181249        synchronized private int getIndex(IEventTaskInstance eti) { 
    182250                int tempindex = -1; 
     
    191259        } 
    192260 
     261        /** 
     262         * Gets the index. 
     263         * 
     264         * @param task the task 
     265         * @return the index 
     266         */ 
    193267        synchronized private int getIndex(ITask task) { 
    194268                int tempindex = -1; 
     
    211285        // } 
    212286 
     287        /* (non-Javadoc) 
     288         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix#getScore(int, int) 
     289         */ 
    213290        @Override 
    214291        public float getScore(int taskId1, int taskId2) { 
     
    230307 
    231308        // TODO: Merge this with updateEventTaskInstances 
     309        /** 
     310         * Search event task instances. 
     311         */ 
    232312        private void searchEventTaskInstances() { 
    233313                for (final Iterator<ITask> it = uniqueTasks.iterator(); it.hasNext();) { 
     
    243323        } 
    244324 
     325        /** 
     326         * Sets the gap penalty. 
     327         * 
     328         * @param gapPenalty the new gap penalty 
     329         */ 
    245330        public void setGapPenalty(float gapPenalty) { 
    246331                this.gapPenalty = gapPenalty; 
    247332        }; 
    248333 
     334        /* (non-Javadoc) 
     335         * @see java.lang.Object#toString() 
     336         */ 
    249337        @Override 
    250338        public String toString() { 
     
    253341 
    254342        // 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         */ 
    255346        @Override 
    256347        public void update(LinkedList<ITask> newTasks) { 
     
    277368        } 
    278369 
     370        /** 
     371         * Update event task instances. 
     372         * 
     373         * @param newTasks the new tasks 
     374         */ 
    279375        public void updateEventTaskInstances(LinkedList<ITask> newTasks) { 
    280376                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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
    36import java.io.Serializable; 
    47 
     8// TODO: Auto-generated Javadoc 
     9/** 
     10 * The Class StaticTriangleMatrix. 
     11 */ 
    512public class StaticTriangleMatrix implements ITriangleMatrix, Serializable { 
    613 
    7         /** 
    8          *  
    9          */ 
     14        /** The Constant serialVersionUID. */ 
    1015        private static final long serialVersionUID = 7599542322424894866L; 
     16         
     17        /** The matrix. */ 
    1118        private final float[] matrix; 
     19         
     20        /** The size. */ 
    1221        protected int size; 
    1322 
     23        /** 
     24         * Instantiates a new static triangle matrix. 
     25         * 
     26         * @param size the size 
     27         */ 
    1428        public StaticTriangleMatrix(int size) { 
    1529                this.size = size; 
     
    1731        } 
    1832 
     33        /* (non-Javadoc) 
     34         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#get(int, int) 
     35         */ 
    1936        @Override 
    2037        public float get(int first, int second) { 
     
    2542        } 
    2643 
     44        /* (non-Javadoc) 
     45         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#increaseSize(int) 
     46         */ 
    2747        @Override 
    2848        public void increaseSize(int count) throws Exception { 
     
    3252        } 
    3353 
     54        /* (non-Javadoc) 
     55         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#initialize(float) 
     56         */ 
    3457        @Override 
    3558        public void initialize(float value) { 
     
    3962        } 
    4063 
     64        /* (non-Javadoc) 
     65         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#set(int, int, float) 
     66         */ 
    4167        @Override 
    4268        public void set(int first, int second, float value) { 
     
    4672        } 
    4773 
     74        /* (non-Javadoc) 
     75         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.ITriangleMatrix#size() 
     76         */ 
    4877        @Override 
    4978        public int size() { 
     
    5180        } 
    5281 
     82        /* (non-Javadoc) 
     83         * @see java.lang.Object#toString() 
     84         */ 
    5385        @Override 
    5486        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 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
     
    69import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    710 
     11// TODO: Auto-generated Javadoc 
     12/** 
     13 * The Interface SubstitutionMatrix. 
     14 */ 
    815public interface SubstitutionMatrix { 
    916 
     17        /** 
     18         * Generate. 
     19         * 
     20         * @param uniqueTasks the unique tasks 
     21         */ 
    1022        public void generate(HashSet<ITask> uniqueTasks); 
    1123 
     24        /** 
     25         * Gets the gap penalty. 
     26         * 
     27         * @return the gap penalty 
     28         */ 
    1229        public float getGapPenalty(); 
    1330 
     31        /** 
     32         * Gets the score. 
     33         * 
     34         * @param pos1 the pos1 
     35         * @param pos2 the pos2 
     36         * @return the score 
     37         */ 
    1438        public float getScore(int pos1, int pos2); 
    1539 
     40        /** 
     41         * Update. 
     42         * 
     43         * @param newlyGeneratedTasks the newly generated tasks 
     44         */ 
    1645        public void update(LinkedList<ITask> newlyGeneratedTasks); 
    1746 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/UPGMAMatrix.java

    r1733 r1734  
     1/* 
     2 *  
     3 */ 
    14package de.ugoe.cs.autoquest.tasktrees.alignment.matrix; 
    25 
     6// TODO: Auto-generated Javadoc 
     7/** 
     8 * The Class UPGMAMatrix. 
     9 */ 
    310public class UPGMAMatrix extends StaticTriangleMatrix { 
    411 
     12        /** 
     13         * Instantiates a new UPGMA matrix. 
     14         * 
     15         * @param size the size 
     16         */ 
    517        public UPGMAMatrix(int size) { 
    618                super(size); 
    719        } 
    820 
     21        /* (non-Javadoc) 
     22         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.StaticTriangleMatrix#size() 
     23         */ 
    924        @Override 
    1025        public int size() { 
     
    1227        } 
    1328 
     29        /* (non-Javadoc) 
     30         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.StaticTriangleMatrix#toString() 
     31         */ 
    1432        @Override 
    1533        public String toString() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/ComponentManager.java

    r1733 r1734  
    2121import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    2222 
     23// TODO: Auto-generated Javadoc 
    2324/** 
    2425 * <p> 
     
    2829 * well as the default task factory. 
    2930 * </p> 
    30  *  
     31 * 
     32 * @author pharms 
    3133 * @version 1.0 
    32  * @author pharms 
    3334 */ 
    3435public class ComponentManager { 
     
    4748         * <p> 
    4849         * returns the default task builder 
    49          * </p> 
    50          *  
     50         * </p>. 
     51         * 
    5152         * @return as described 
    5253         */ 
     
    5859         * <p> 
    5960         * returns the default task factory 
    60          * </p> 
    61          *  
     61         * </p>. 
     62         * 
    6263         * @return as described 
    6364         */ 
     
    6970         * <p> 
    7071         * returns the singleton instance of this class 
    71          * </p> 
    72          *  
     72         * </p>. 
     73         * 
    7374         * @return as described 
    7475         */ 
     
    8485         * <p> 
    8586         * returns the default temporal relationship rule manager 
    86          * </p> 
    87          *  
     87         * </p>. 
     88         * 
    8889         * @return as described 
    8990         */ 
     
    9293        } 
    9394 
    94         /** 
    95          * <p> 
    96          * singleton instance of this class 
    97          * </p> 
    98          */ 
     95        /** <p> singleton instance of this class </p>. */ 
    9996        private static ComponentManager instance; 
    10097 
    101         /** 
    102          * <p> 
    103          * the default temporal relationship rule manager 
    104          * </p> 
    105          */ 
     98        /** <p> the default temporal relationship rule manager </p>. */ 
    10699        private TemporalRelationshipRuleManager temporalRelationshipRuleManager; 
    107100 
    108         /** 
    109          * <p> 
    110          * the default task builder 
    111          * </p> 
    112          */ 
     101        /** <p> the default task builder </p>. */ 
    113102        private ITaskBuilder taskBuilder; 
    114103 
    115         /** 
    116          * <p> 
    117          * the default task factory 
    118          * </p> 
    119          */ 
     104        /** <p> the default task factory </p>. */ 
    120105        private ITaskFactory taskFactory; 
    121106 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/manager/TaskTreeManager.java

    r1733 r1734  
    2828import de.ugoe.cs.util.console.Console; 
    2929 
     30// TODO: Auto-generated Javadoc 
    3031/** 
    3132 * <p> 
     
    3738 * well. 
    3839 * </p> 
    39  *  
     40 * 
     41 * @author pharms 
    4042 * @version 1.0 
    41  * @author pharms 
    4243 */ 
    4344public class TaskTreeManager { 
    4445 
    45         /** 
    46          * <p> 
    47          * the internally used task builder 
    48          * </p> 
    49          */ 
     46        /** <p> the internally used task builder </p>. */ 
    5047        private final ITaskBuilder taskBuilder = ComponentManager 
    5148                        .getDefaultTaskBuilder(); 
    5249 
    53         /** 
    54          * <p> 
    55          * the internally used task factory 
    56          * </p> 
    57          */ 
     50        /** <p> the internally used task factory </p>. */ 
    5851        private final ITaskFactory taskFactory = ComponentManager 
    5952                        .getDefaultTaskFactory(); 
    6053 
    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>. */ 
    6655        private List<IUserSession> sessions = null; 
    6756 
    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>. */ 
    7358        private IUserSession currentSession = null; 
    7459 
     
    7661         * <p> 
    7762         * initializes the task tree manager 
    78          * </p> 
     63         * </p>. 
    7964         */ 
    8065        public TaskTreeManager() { 
     
    8570         * <p> 
    8671         * internally asserts that there is a current session to add new events to 
    87          * </p> 
     72         * </p>. 
    8873         */ 
    8974        private void assertSessionSequence() { 
     
    10388         * return value of this method. 
    10489         * </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 
    10992         * @return the task model created from the user sessions 
    110          *  
    111          * @throws IllegalStateException 
    112          *             if the task manager is already used by providing it with 
    113          *             single events 
    11493         */ 
    11594        public synchronized ITaskModel createTaskModel( 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRule.java

    r1733 r1734  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2323 
     24// TODO: Auto-generated Javadoc 
    2425/** 
    2526 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/GUIEventTaskComparisonRule.java

    r1733 r1734  
    4747import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    4848 
     49// TODO: Auto-generated Javadoc 
    4950/** 
    5051 * <p> 
     
    457458         * </p> 
    458459         * 
    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 
    470463         * @return as described 
    471464         */ 
     
    573566 
    574567        /** 
    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 
    576574         */ 
    577575        private TaskEquality getEquality(ITask task1, ITask task2, 
     
    618616 
    619617        /** 
    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 
    621624         */ 
    622625        private TaskEquality getEquality(ITaskInstance instance1, 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/IterationComparisonRule.java

    r1733 r1734  
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2222 
     23// TODO: Auto-generated Javadoc 
    2324/** 
    2425 * <p> 
     
    7980 * </tr> 
    8081 * </table> 
    81  *  
     82 * 
     83 * @author 2012, last modified by $Author: patrick$ 
    8284 * @version $Revision: $ $Date: 19.02.2012$ 
    83  * @author 2012, last modified by $Author: patrick$ 
    8485 */ 
    8586public class IterationComparisonRule implements TaskComparisonRule { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SelectionComparisonRule.java

    r1733 r1734  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2323 
     24// TODO: Auto-generated Javadoc 
    2425/** 
    2526 * <p> 
     
    3637 * equality is checked for and this equality is ensured. 
    3738 * </p> 
    38  *  
     39 * 
     40 * @author 2012, last modified by $Author: patrick$ 
    3941 * @version $Revision: $ $Date: 19.02.2012$ 
    40  * @author 2012, last modified by $Author: patrick$ 
    4142 */ 
    4243public class SelectionComparisonRule implements TaskComparisonRule { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SequenceComparisonRule.java

    r1733 r1734  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2323 
     24// TODO: Auto-generated Javadoc 
    2425/** 
    2526 * <p> 
     
    2930 * can not decide, if two sequences are syntactically or semantically equal. 
    3031 * </p> 
    31  *  
     32 * 
     33 * @author 2012, last modified by $Author: patrick$ 
    3234 * @version $Revision: $ $Date: 19.02.2012$ 
    33  * @author 2012, last modified by $Author: patrick$ 
    3435 */ 
    3536public class SequenceComparisonRule implements TaskComparisonRule { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndIterationComparisonRule.java

    r1733 r1734  
    2020import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2121 
     22// TODO: Auto-generated Javadoc 
    2223/** 
    2324 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRule.java

    r1733 r1734  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2323 
     24// TODO: Auto-generated Javadoc 
    2425/** 
    2526 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskComparisonRule.java

    r1733 r1734  
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    2425 * to be called for a comparison. 
    2526 * </p> 
    26  *  
     27 * 
     28 * @author 2012, last modified by $Author: patrick$ 
    2729 * @version $Revision: $ $Date: 19.02.2012$ 
    28  * @author 2012, last modified by $Author: patrick$ 
    2930 */ 
    3031public interface TaskComparisonRule { 
     
    3334         * <p> 
    3435         * 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 
    4240         * @return true, if the tasks are equal, false else 
    4341         */ 
     
    4745         * <p> 
    4846         * 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 
    5651         * @return true, if the tasks are equal, false else 
    5752         */ 
     
    6257         * <p> 
    6358         * 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 
    7163         * @return true, if the tasks are equal, false else 
    7264         */ 
     
    7668         * <p> 
    7769         * 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 
    8574         * @return true, if the tasks are equal, false else 
    8675         */ 
     
    9180         * <p> 
    9281         * 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 
    10086         * @return true, if the tasks are equal, false else 
    10187         */ 
     
    10591         * <p> 
    10692         * 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 
    11497         * @return true, if the tasks are equal, false else 
    11598         */ 
     
    152135         * <p> 
    153136         * 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 
    161141         * @return true, if the rule is applicable, false else 
    162142         */ 
     
    167147         * checks if the rule is applicable for comparing the two provided task 
    168148         * 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 
    176153         * @return true, if the rule is applicable, false else 
    177154         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEquality.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    5859 * are always also semantically equal. 
    5960 * </p> 
    60  *  
     61 * 
     62 * @author 2012, last modified by $Author: patrick$ 
    6163 * @version $Revision: $ $Date: 19.02.2012$ 
    62  * @author 2012, last modified by $Author: patrick$ 
    6364 */ 
    6465public 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; 
    6677 
    6778        /** 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEqualityRuleManager.java

    r1733 r1734  
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2222 
     23// TODO: Auto-generated Javadoc 
    2324/** 
    2425 * <p> 
     
    3738         * <p> 
    3839         * returns the singleton instance of this class 
    39          * </p> 
    40          *  
     40         * </p>. 
     41         * 
    4142         * @return as described 
    4243         */ 
     
    4546        } 
    4647 
    47         /** 
    48          * <p> 
    49          * the singleton instance of this class 
    50          * </p> 
    51          */ 
     48        /** <p> the singleton instance of this class </p>. */ 
    5249        private static final TaskEqualityRuleManager instance = new TaskEqualityRuleManager(); 
    5350 
    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>. */ 
    5952        private List<TaskComparisonRule> mRuleIndex = null; 
    6053 
     
    8275         * returns true, if this level is given. 
    8376         * </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 
    9782         */ 
    9883        public boolean areAtLeastEqual(ITask task1, ITask task2, 
     
    125110         * equality level and returns true, if this level is given. 
    126111         * </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 
    140117         */ 
    141118        public boolean areAtLeastEqual(ITaskInstance instance1, 
     
    170147         * method returns false. 
    171148         * </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 
    183153         */ 
    184154        public boolean areIdentical(ITask task1, ITask task2) { 
     
    204174         * true, this method returns false. 
    205175         * </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 
    217180         */ 
    218181        public boolean areIdentical(ITaskInstance instance1, ITaskInstance instance2) { 
     
    238201         * this method returns false. 
    239202         * </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 
    251207         */ 
    252208        public boolean areLexicallyEqual(ITask task1, ITask task2) { 
     
    272228         * true, this method returns false. 
    273229         * </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 
    285234         */ 
    286235        public boolean areLexicallyEqual(ITaskInstance instance1, 
     
    307256         * true, this method returns false. 
    308257         * </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 
    320262         */ 
    321263        public boolean areSemanticallyEqual(ITask task1, ITask task2) { 
     
    341283         * returns true, this method returns false. 
    342284         * </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 
    354289         */ 
    355290        public boolean areSemanticallyEqual(ITaskInstance instance1, 
     
    376311         * true, this method returns false. 
    377312         * </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 
    389317         */ 
    390318        public boolean areSyntacticallyEqual(ITask task1, ITask task2) { 
     
    410338         * returns true, this method returns false. 
    411339         * </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 
    423344         */ 
    424345        public boolean areSyntacticallyEqual(ITaskInstance instance1, 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskIdentityRule.java

    r1733 r1734  
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    2425 * Else it returns null to denote, that it can not compare the tasks. 
    2526 * </p> 
    26  *  
     27 * 
     28 * @author 2012, last modified by $Author: patrick$ 
    2729 * @version $Revision: $ $Date: 19.02.2012$ 
    28  * @author 2012, last modified by $Author: patrick$ 
    2930 */ 
    3031public class TaskIdentityRule implements TaskComparisonRule { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/ISessionScopeRule.java

    r1733 r1734  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
    2020 
     21// TODO: Auto-generated Javadoc 
    2122/** 
    2223 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/ITaskInstanceScopeRule.java

    r1733 r1734  
    1717import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleApplicationResult.java

    r1733 r1734  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2323 
     24// TODO: Auto-generated Javadoc 
    2425/** 
    2526 * <p> 
     
    3536class RuleApplicationResult implements Serializable { 
    3637 
    37         /** 
    38          *  
    39          */ 
     38        /** The Constant serialVersionUID. */ 
    4039        private static final long serialVersionUID = -5927099713841481328L; 
    4140 
    42         /** */ 
     41        /** The status. */ 
    4342        private RuleApplicationStatus status = RuleApplicationStatus.NOT_APPLIED; 
    4443 
    45         /** */ 
     44        /** The new parent tasks. */ 
    4645        private final List<ITask> newParentTasks = new ArrayList<ITask>(); 
    4746 
    48         /** */ 
     47        /** The new parent instances. */ 
    4948        private final List<ITaskInstance> newParentInstances = new ArrayList<ITaskInstance>(); 
    5049 
     
    5352         * create a rule application result with a status 
    5453         * {@link RuleApplicationStatus#RULE_NOT_APPLIED} 
    55          * </p> 
     54         * </p>. 
    5655         */ 
    5756        RuleApplicationResult() { 
     
    6261         * <p> 
    6362         * add a further parent task created during the rule application 
    64          * </p> 
     63         * </p>. 
     64         * 
     65         * @param newParent the new parent 
    6566         */ 
    6667        void addNewlyCreatedTask(ITask newParent) { 
     
    7172         * <p> 
    7273         * add a further parent task instance created during the rule application 
    73          * </p> 
     74         * </p>. 
     75         * 
     76         * @param newParent the new parent 
    7477         */ 
    7578        void addNewlyCreatedTaskInstance(ITaskInstance newParent) { 
     
    8083         * <p> 
    8184         * return all parent task instances created during the rule application 
    82          * </p> 
     85         * </p>. 
     86         * 
     87         * @return the newly created task instances 
    8388         */ 
    8489        List<ITaskInstance> getNewlyCreatedTaskInstances() { 
     
    8994         * <p> 
    9095         * return all parent tasks created during the rule application 
    91          * </p> 
     96         * </p>. 
     97         * 
     98         * @return the newly created tasks 
    9299         */ 
    93100        List<ITask> getNewlyCreatedTasks() { 
     
    98105         * <p> 
    99106         * return the rule application status 
    100          * </p> 
     107         * </p>. 
     108         * 
     109         * @return the rule application status 
    101110         */ 
    102111        RuleApplicationStatus getRuleApplicationStatus() { 
     
    107116         * <p> 
    108117         * set the rule application status 
    109          * </p> 
     118         * </p>. 
     119         * 
     120         * @param status the new rule application status 
    110121         */ 
    111122        void setRuleApplicationStatus(RuleApplicationStatus status) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleApplicationStatus.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    2526 */ 
    2627enum RuleApplicationStatus { 
    27         FINISHED, NOT_APPLIED; 
     28         
     29        /** The finished. */ 
     30        FINISHED,  
     31 /** The not applied. */ 
     32 NOT_APPLIED; 
    2833} 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java

    r1733 r1734  
    2828import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    2929 
     30 
    3031/** 
    3132 * <p> 
    3233 * provides some convenience methods for rule application 
    33  * </p> 
    34  *  
     34 * </p>. 
     35 * 
    3536 * @author Patrick Harms 
    3637 */ 
     
    4142         * replaces a sub sequence for a specified range of elements in the provided 
    4243         * 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 
    5852         * @return the replacement for the range 
    59          * @throws 
    6053         */ 
    6154        static ISequenceInstance createNewSubSequenceInRange( 
     
    6558                                .createNewTaskInstance(model); 
    6659 
    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 
    9562                missedOptionals = 0; 
    9663                int modelindex = 0; 
     
    144111                                                        || (parent.get(startIndex).getTask().getId() == tmpSel 
    145112                                                                        .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                                                 // ); 
    151113                                                continue; 
    152114                                        } 
     
    154116                                        for (int k = 0; k < selseq.getSequence().getChildren() 
    155117                                                        .size(); k++) { 
    156                                                 // System.out.println("Trying to add " + 
    157                                                 // parent.get(startIndex) + " to " + selseq); 
    158118                                                taskBuilder.addChild(selseq, parent.get(startIndex)); 
    159119                                                taskBuilder.removeTaskInstance(parent, startIndex); 
    160120                                                i++; 
    161                                                 // System.out.println("I:" + i); 
    162121                                        } 
    163                                         // System.out.println("Trying to add " + selseq + " to " + 
    164                                         // tmpSel); 
    165122                                        taskBuilder.setChild(selection, selseq); 
    166123                                        taskBuilder.addChild(subsequence, selection); 
     
    168125                                        continue; 
    169126                                } else { 
    170                                         // System.out.println("Trying to adding SelectionInstance " 
    171                                         // + parent.get(startIndex) + " to " + tempTask); 
    172127                                        taskBuilder.setChild(selection, parent.get(startIndex)); 
    173128                                        taskBuilder.addChild(subsequence, selection); 
    174129                                } 
    175130                        } else if (tempTask.getType() == "sequence") { 
    176                                 // System.out.println("Adding SequenceInstance " + 
    177                                 // parent.get(startIndex) + " to " + tempTask); 
    178131                                taskBuilder.addChild(subsequence, parent.get(startIndex)); 
    179132                        } else if (tempTask.getType() == "iteration") { 
    180                                 // System.out.println("Adding IterationInstance " + 
    181                                 // parent.get(startIndex) + " to " + tempTask); 
    182133                                taskBuilder.addChild(subsequence, parent.get(startIndex)); 
    183134                        } else { 
    184                                 // System.out.println("Adding EventInstance " + 
    185                                 // parent.get(startIndex) + " to " + tempTask); 
    186                                 // System.out.println("Foo"); 
    187135                                taskBuilder.addChild(subsequence, parent.get(startIndex)); 
    188136                        } 
     
    199147         * <p> 
    200148         * returns the next available id (uses the id counter) 
    201          * </p> 
    202          *  
     149         * </p>. 
     150         * 
    203151         * @return the next available id 
    204152         */ 
     
    241189        } 
    242190 
    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         */ 
    244198        static void printProgressPercentage(String message, int count, int size) { 
    245199                if (size > 100) { 
     
    270224        private static int idCounter = 0; 
    271225 
     226        /** The missed optionals. */ 
    272227        public static int missedOptionals = 0; 
    273228 
     
    275230         * <p> 
    276231         * prevent instantiation 
    277          * </p> 
     232         * </p>. 
    278233         */ 
    279234        private RuleUtils() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRule.java

    r1733 r1734  
    4343import de.ugoe.cs.util.console.Console; 
    4444 
     45// TODO: Auto-generated Javadoc 
    4546/** 
    4647 * <p> 
     
    6667 
    6768        /** 
     69         * The Class MaxCountAndLongestTasksFinder. 
     70         * 
    6871         * @author Patrick Harms 
    6972         */ 
     
    7174                        TrieProcessor<ITaskInstance> { 
    7275 
    73                 /** 
    74                  *  
    75                  */ 
     76                /** The current count. */ 
    7677                private int currentCount; 
    7778 
    78                 /** 
    79                  *  
    80                  */ 
     79                /** The found tasks. */ 
    8180                private final List<List<ITaskInstance>> foundTasks = new LinkedList<List<ITaskInstance>>(); 
    8281 
    8382                /** 
    84                  * 
     83                 * Instantiates a new max count and longest tasks finder. 
    8584                 */ 
    8685                public MaxCountAndLongestTasksFinder() { 
     
    9089 
    9190                /** 
    92                  * @return 
     91                 * Gets the found tasks. 
     92                 * 
     93                 * @return the found tasks 
    9394                 */ 
    9495                public Tasks getFoundTasks() { 
     
    158159 
    159160                /** 
    160                  * 
     161                 * Removes the permutations of shorter tasks. 
    161162                 */ 
    162163                private void removePermutationsOfShorterTasks() { 
     
    189190 
    190191        /** 
    191          *  
     192         * The Class RuleApplicationData. 
    192193         */ 
    193194        private static class RuleApplicationData { 
    194195 
    195                 /** 
    196                  *  
    197                  */ 
     196                /** The sessions. */ 
    198197                private final List<IUserSession> sessions; 
    199198 
    200                 /** 
    201                  *  
    202                  */ 
     199                /** The last trie. */ 
    203200                private TaskInstanceTrie lastTrie; 
    204201 
    205                 /** 
    206                  * default and minimum trained sequence length is 3 
    207                  */ 
     202                /** default and minimum trained sequence length is 3. */ 
    208203                private int trainedSequenceLength = 3; 
    209204 
    210                 /** 
    211                  *  
    212                  */ 
     205                /** The last found tasks. */ 
    213206                private Tasks lastFoundTasks = new Tasks(Integer.MAX_VALUE, null); 
    214207 
    215                 /** 
    216                  *  
    217                  */ 
     208                /** The detected and replaced tasks. */ 
    218209                private boolean detectedAndReplacedTasks; 
    219210 
    220                 /** 
    221                  *  
    222                  */ 
     211                /** The result. */ 
    223212                private final RuleApplicationResult result = new RuleApplicationResult(); 
    224213 
    225                 /** 
    226                  *  
    227                  */ 
     214                /** The stop watch. */ 
    228215                private final StopWatch stopWatch = new StopWatch(); 
    229216 
    230217                /** 
    231                  *  
     218                 * Instantiates a new rule application data. 
     219                 * 
     220                 * @param sessions the sessions 
    232221                 */ 
    233222                private RuleApplicationData(List<IUserSession> sessions) { 
     
    236225 
    237226                /** 
    238                  * 
     227                 * Detected and replaced tasks. 
     228                 * 
     229                 * @return true, if successful 
    239230                 */ 
    240231                private boolean detectedAndReplacedTasks() { 
     
    243234 
    244235                /** 
    245                  * 
     236                 * Detected and replaced tasks. 
     237                 * 
     238                 * @param detectedAndReplacedTasks the detected and replaced tasks 
    246239                 */ 
    247240                private void detectedAndReplacedTasks(boolean detectedAndReplacedTasks) { 
     
    250243 
    251244                /** 
     245                 * Gets the last found tasks. 
     246                 * 
    252247                 * @return the lastFoundSequences 
    253248                 */ 
     
    257252 
    258253                /** 
     254                 * Gets the last trie. 
     255                 * 
    259256                 * @return the lastTrie 
    260257                 */ 
     
    264261 
    265262                /** 
     263                 * Gets the result. 
     264                 * 
    266265                 * @return the result 
    267266                 */ 
     
    271270 
    272271                /** 
     272                 * Gets the sessions. 
     273                 * 
    273274                 * @return the tree 
    274275                 */ 
     
    278279 
    279280                /** 
     281                 * Gets the stop watch. 
     282                 * 
    280283                 * @return the stopWatch 
    281284                 */ 
     
    285288 
    286289                /** 
     290                 * Gets the trained sequence length. 
     291                 * 
    287292                 * @return the trainedSequenceLength 
    288293                 */ 
     
    292297 
    293298                /** 
    294                  * @param lastFoundSequences 
    295                  *            the lastFoundSequences to set 
     299                 * Sets the last found tasks. 
     300                 * 
     301                 * @param lastFoundSequences            the lastFoundSequences to set 
    296302                 */ 
    297303                private void setLastFoundTasks(Tasks lastFoundSequences) { 
     
    300306 
    301307                /** 
    302                  * @param lastTrie 
    303                  *            the lastTrie to set 
     308                 * Sets the last trie. 
     309                 * 
     310                 * @param lastTrie            the lastTrie to set 
    304311                 */ 
    305312                private void setLastTrie(TaskInstanceTrie lastTrie) { 
     
    308315 
    309316                /** 
    310                  * @param trainedSequenceLength 
    311                  *            the trainedSequenceLength to set 
     317                 * Sets the trained sequence length. 
     318                 * 
     319                 * @param trainedSequenceLength            the trainedSequenceLength to set 
    312320                 */ 
    313321                private void setTrainedSequenceLength(int trainedSequenceLength) { 
     
    318326 
    319327        /** 
     328         * The Class Tasks. 
     329         * 
    320330         * @author Patrick Harms 
    321331         */ 
    322332        private static class Tasks implements Iterable<List<ITaskInstance>> { 
    323333 
    324                 /** 
    325                  *  
    326                  */ 
     334                /** The occurrence count. */ 
    327335                private final int occurrenceCount; 
    328336 
    329                 /** 
    330                  *  
    331                  */ 
     337                /** The sequences. */ 
    332338                private final List<List<ITaskInstance>> sequences; 
    333339 
    334340                /** 
    335                  * @param occurrenceCount 
    336                  * @param sequences 
     341                 * Instantiates a new tasks. 
     342                 * 
     343                 * @param occurrenceCount the occurrence count 
     344                 * @param sequences the sequences 
    337345                 */ 
    338346                private Tasks(int occurrenceCount, List<List<ITaskInstance>> sequences) { 
     
    343351 
    344352                /** 
    345                  * @return 
     353                 * Gets the occurrence count. 
     354                 * 
     355                 * @return the occurrence count 
    346356                 */ 
    347357                private int getOccurrenceCount() { 
     
    364374 
    365375                /** 
    366                  * @return 
     376                 * Size. 
     377                 * 
     378                 * @return the int 
    367379                 */ 
    368380                private int size() { 
     
    391403        } 
    392404 
    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>. */ 
    399406        private final ITaskFactory taskFactory;; 
    400407 
    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>. */ 
    407409        private final ITaskBuilder taskBuilder; 
    408410 
     
    498500 
    499501        /** 
    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 
    502505         *            this rule 
    503506         */ 
     
    554557 
    555558        /** 
    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 
    560562         *            this rule 
    561563         */ 
     
    578580 
    579581        /** 
    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 
    582585         *            this rule 
     586         * @return the sequences occuring most often 
    583587         */ 
    584588        private void getSequencesOccuringMostOften(RuleApplicationData appData) { 
     
    668672 
    669673        /** 
    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 
    673680         */ 
    674681        private int getSubListIndex(ITaskInstanceList list, 
     
    702709 
    703710        /** 
    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 
    707717         */ 
    708718        private int getSubListIndex(List<ITaskInstance> list, 
     
    790800         * <p> 
    791801         * TODO clarify why this is done 
    792          * </p> 
     802         * </p>. 
     803         * 
     804         * @param iteration the iteration 
     805         * @param iterationInstances the iteration instances 
    793806         */ 
    794807        private void harmonizeIterationInstancesModel(IIteration iteration, 
     
    851864 
    852865        /** 
    853          * 
     866         * Harmonize sequence instances model. 
     867         * 
     868         * @param sequence the sequence 
     869         * @param sequenceInstances the sequence instances 
     870         * @param sequenceLength the sequence length 
    854871         */ 
    855872        private void harmonizeSequenceInstancesModel(ISequence sequence, 
     
    924941         * <p> 
    925942         * 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 
    934948         *            this rule 
    935949         */ 
     
    9901004 
    9911005        /** 
    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 
    9941009         *            this rule 
    9951010         */ 
     
    10321047 
    10331048        /** 
    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 
    10351055         */ 
    10361056        private List<ISequenceInstance> replaceTaskOccurrences( 
     
    11161136         * iterated, it is added to the returned set. 
    11171137         * </p> 
    1118          *  
    1119          * @param the 
    1120          *            session to search for iterations in 
    1121          *  
     1138         * 
     1139         * @param sessions the sessions 
    11221140         * @return a set of tasks being iterated somewhere 
    11231141         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 
    1616 
    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; 
    2217import java.io.Serializable; 
    2318import java.util.ArrayList; 
     
    3631import java.util.logging.Level; 
    3732 
    38 import de.ugoe.cs.autoquest.CommandHelpers; 
    3933import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithm; 
    4034import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithmFactory; 
     
    5953import de.ugoe.cs.util.StopWatch; 
    6054import de.ugoe.cs.util.console.Console; 
    61 import de.ugoe.cs.util.console.GlobalDataContainer; 
     55 
    6256 
    6357/** 
     
    6660 * of recorded user sessions. For this, it first harmonizes all tasks. This 
    6761 * eases later comparison. Then it searches the sessions for iterations and 
    68  * replaces them accordingly. Then it searches for sub sequences being the 
    69  * longest and occurring most often. For each found sub sequence, it replaces 
     62 * replaces them accordingly. Then it searches for sub sequences using alignment algorithms 
     63 * For each found sub sequence, it replaces 
    7064 * the occurrences by creating appropriate {@link ISequence}s. Afterwards, again 
    7165 * searches for iterations and then again for sub sequences until no more 
     
    7569 *  
    7670 *  
    77  * @author Patrick Harms 
     71 * @author Ralph Krimmel 
    7872 */ 
    7973public class SequenceForTaskDetectionRuleAlignment implements ISessionScopeRule { 
    8074 
     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         */ 
    81965        private class ParallelMatchOcurrencesFinder implements Runnable { 
     966                 
     967                /** The app data. */ 
    82968                private final RuleApplicationData appData; 
     969                 
     970                /** The from. */ 
    83971                private final int from; 
     972                 
     973                /** The to. */ 
    84974                private final int to; 
    85975 
     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                 */ 
    86983                ParallelMatchOcurrencesFinder(RuleApplicationData appData, int from, 
    87984                                int to) { 
     
    91988                } 
    92989 
     990                /* (non-Javadoc) 
     991                 * @see java.lang.Runnable#run() 
     992                 */ 
    93993                @Override 
    94994                public void run() { 
     
    1291029        } 
    1301030 
     1031        /** 
     1032         * The Class ParallelMatchReplacer. 
     1033         */ 
    1311034        private class ParallelMatchReplacer implements Runnable { 
    1321035 
     1036                /** The app data. */ 
    1331037                private final RuleApplicationData appData; 
     1038                 
     1039                /** The from. */ 
    1341040                private final int from; 
     1041                 
     1042                /** The to. */ 
    1351043                private final int to; 
    1361044 
     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                 */ 
    1371052                ParallelMatchReplacer(RuleApplicationData appData, int from, int to) { 
    1381053                        this.appData = appData; 
     
    1411056                } 
    1421057 
     1058                /* (non-Javadoc) 
     1059                 * @see java.lang.Runnable#run() 
     1060                 */ 
    1431061                @Override 
    1441062                public void run() { 
     
    1641082                                                // want to replace now 
    1651083 
    166                                                 synchronized (appData.getReplacedOccurences()) { 
    167                                                         if (appData.getReplacedOccurences().get( 
     1084                                                synchronized (appData.getReplacedOccurrences()) { 
     1085                                                        if (appData.getReplacedOccurrences().get( 
    1681086                                                                        oc.getSequenceId()) == null) { 
    169                                                                 appData.getReplacedOccurences().put( 
     1087                                                                appData.getReplacedOccurrences().put( 
    1701088                                                                                oc.getSequenceId(), 
    1711089                                                                                new LinkedList<MatchOccurence>()); 
     
    1861104                                                                // harmonized. 
    1871105                                                                for (final Iterator<MatchOccurence> jt = appData 
    188                                                                                 .getReplacedOccurences() 
     1106                                                                                .getReplacedOccurrences() 
    1891107                                                                                .get(oc.getSequenceId()).iterator(); jt 
    1901108                                                                                .hasNext();) { 
     
    2391157                                                // instance. (OptionalInstances may be shorter) 
    2401158 
    241                                                 synchronized (appData.getReplacedOccurences().get( 
     1159                                                synchronized (appData.getReplacedOccurrences().get( 
    2421160                                                                oc.getSequenceId())) { 
    243                                                         appData.getReplacedOccurences() 
     1161                                                        appData.getReplacedOccurrences() 
    2441162                                                        .get(oc.getSequenceId()).add(oc); 
    2451163                                                } 
     
    2501168        } 
    2511169 
     1170        /** 
     1171         * The Class ParallelPairwiseAligner. 
     1172         */ 
    2521173        private class ParallelPairwiseAligner implements Runnable { 
     1174                 
     1175                /** The app data. */ 
    2531176                private final RuleApplicationData appData; 
     1177                 
     1178                /** The from. */ 
    2541179                private final int from; 
     1180                 
     1181                /** The to. */ 
    2551182                private final int to; 
    2561183 
     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                 */ 
    2571191                ParallelPairwiseAligner(RuleApplicationData appData, int from, int to) { 
    2581192                        this.appData = appData; 
     
    2611195                } 
    2621196 
     1197                /* (non-Javadoc) 
     1198                 * @see java.lang.Runnable#run() 
     1199                 */ 
    2631200                @Override 
    2641201                public void run() { 
     
    2861223                } 
    2871224        } 
    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         
    11621226} 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskHandlingStrategy.java

    r1733 r1734  
    2121import de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy; 
    2222 
     23// TODO: Auto-generated Javadoc 
    2324/** 
    2425 * <p> 
     
    3536public class TaskHandlingStrategy implements SymbolStrategy<ITaskInstance> { 
    3637 
    37         /** */ 
     38        /** The Constant serialVersionUID. */ 
    3839        private static final long serialVersionUID = 1L; 
    3940 
    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>. */ 
    4542        private final TaskEquality consideredEquality; 
    4643 
    47         /** 
    48          * <p> 
    49          * the comparator used for task comparisons 
    50          * </p> 
    51          */ 
     44        /** <p> the comparator used for task comparisons </p>. */ 
    5245        private TaskInstanceComparator comparator; 
    5346 
     
    5649         * initializes this strategy with a task equality to be considered for task 
    5750         * comparisons g 
    58          * </p> 
     51         * </p>. 
    5952         * 
    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 
    6254         */ 
    6355        public TaskHandlingStrategy(TaskEquality consideredEquality) { 
     
    117109         * convenience method to have a correctly typed return value as alternative 
    118110         * to {@link #getSymbolComparator()}; 
    119          * </p> 
     111         * </p>. 
     112         * 
     113         * @return the task comparator 
    120114         */ 
    121115        public TaskInstanceComparator getTaskComparator() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskIdentityComparator.java

    r1733 r1734  
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    2728class TaskIdentityComparator extends TaskInstanceComparator { 
    2829 
    29         /** */ 
     30        /** The Constant serialVersionUID. */ 
    3031        private static final long serialVersionUID = 1L; 
    3132 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskInstanceComparator.java

    r1733 r1734  
    2525import de.ugoe.cs.autoquest.usageprofiles.SymbolComparator; 
    2626 
     27// TODO: Auto-generated Javadoc 
    2728/** 
    2829 * <p> 
     
    4041         * <p> 
    4142         * interface for internally used comparers containing only a compare method 
    42          * </p> 
     43         * </p>. 
    4344         */ 
    4445        private static interface Comparer { 
     
    4849                 * returns true, if this comparator considers the provided tasks as 
    4950                 * 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 
    5755                 * @return as described 
    5856                 */ 
     
    6361         * <p> 
    6462         * comparer that performs comparisons only on the provided level 
    65          * </p> 
     63         * </p>. 
    6664         */ 
    6765        private static class DefaultComparer implements Comparer { 
    6866 
    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>. */ 
    7468                private final TaskEquality minimalTaskEquality; 
    7569 
     
    7771                 * <p> 
    7872                 * initializes this comparer with the task equality to be considered 
    79                  * </p> 
     73                 * </p>. 
     74                 * 
     75                 * @param minimalTaskEquality the minimal task equality 
    8076                 */ 
    8177                public DefaultComparer(TaskEquality minimalTaskEquality) { 
     
    9894         * <p> 
    9995         * comparer that performs comparisons only on the lexical level 
    100          * </p> 
     96         * </p>. 
    10197         */ 
    10298        private static class LexicalComparer implements Comparer { 
     
    117113         * <p> 
    118114         * comparer that performs comparisons only on the semantical level 
    119          * </p> 
     115         * </p>. 
    120116         */ 
    121117        private static class SemanticalComparer implements Comparer { 
     
    136132         * <p> 
    137133         * comparer that performs comparisons only on the syntactical level 
    138          * </p> 
    139          *  
     134         * </p>. 
    140135         */ 
    141136        private static class SyntacticalComparer implements Comparer { 
     
    153148        } 
    154149 
    155         /** */ 
     150        /** The Constant serialVersionUID. */ 
    156151        private static final long serialVersionUID = 1L; 
    157152 
    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. */ 
    162154        private static final int MAX_BUFFER_SIZE = 2 * 1024 * 1024; 
    163155 
    164         /** 
    165          * the considered level of task equality 
    166          */ 
     156        /** the considered level of task equality. */ 
    167157        private final TaskEquality minimalTaskEquality; 
    168158 
    169         /** 
    170          * the comparer used internally for comparing two tasks 
    171          */ 
     159        /** the comparer used internally for comparing two tasks. */ 
    172160        private transient Comparer comparer; 
    173161 
    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. */ 
    177163        private transient Comparer lexicalComparer; 
    178164 
    179         /** 
    180          * internal buffer used for storing comparison results 
    181          */ 
     165        /** internal buffer used for storing comparison results. */ 
    182166        private transient HashMap<Long, Boolean> equalityBuffer = new HashMap<Long, Boolean>(); 
    183167 
    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. */ 
    188169        private transient HashMap<Long, Boolean> lexicalEqualityBuffer; 
    189170 
     
    191172         * <p> 
    192173         * 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 
    197177         */ 
    198178        public TaskInstanceComparator(TaskEquality minimalTaskEquality) { 
     
    205185         * returns true, if this comparator considers the provided tasks as 
    206186         * 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 
    214191         * @return as described 
    215192         */ 
     
    239216         * <p> 
    240217         * can be called externally to clear the internal comparison buffers 
    241          * </p> 
     218         * </p>. 
    242219         */ 
    243220        public void clearBuffers() { 
     
    250227         * returns true, if this comparator considers the provided tasks as equal, 
    251228         * 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 
    259233         * @return as described 
    260234         */ 
     
    329303         * <p> 
    330304         * 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 
    332310         */ 
    333311        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  
    2727import de.ugoe.cs.autoquest.usageprofiles.TrieProcessor; 
    2828 
     29// TODO: Auto-generated Javadoc 
    2930/** 
    3031 * <p> 
     
    4546         * <p> 
    4647         * counter object to be able to call something by the counters reference 
    47          * </p> 
    48          *  
     48         * </p>. 
     49         * 
    4950         * @author Patrick Harms 
    5051         */ 
    5152        private static class Counter { 
     53                 
     54                /** The count. */ 
    5255                int count = 0; 
    5356        } 
     
    5760         * trie processor identifying the current maximum count of sequences of a 
    5861         * minimal length of two 
    59          * </p> 
    60          *  
     62         * </p>. 
     63         * 
    6164         * @author Patrick Harms 
    6265         */ 
     
    6467                        TrieProcessor<ITaskInstance> { 
    6568 
    66                 /** 
    67                  * <p> 
    68                  * the current maximum count 
    69                  * </p> 
    70                  */ 
     69                /** <p> the current maximum count </p>. */ 
    7170                private int currentCount = 0; 
    7271 
     
    7473                 * <p> 
    7574                 * returns the current maximum count 
    76                  * </p> 
     75                 * </p>. 
     76                 * 
     77                 * @return the max count 
    7778                 */ 
    7879                private int getMaxCount() { 
     
    102103        } 
    103104 
    104         /** */ 
     105        /** The Constant serialVersionUID. */ 
    105106        private static final long serialVersionUID = 1L; 
    106107 
    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>. */ 
    112109        private final TaskHandlingStrategy taskStrategy; 
    113110 
     
    115112         * <p> 
    116113         * 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 
    121117         */ 
    122118        public TaskInstanceTrie(TaskHandlingStrategy taskStrategy) { 
     
    170166         * internally used convenience method for implementing the training 
    171167         * 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 
    173175         */ 
    174176        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  
    3434import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 
    3535 
     36// TODO: Auto-generated Javadoc 
    3637/** 
    3738 * <p> 
     
    5354 * symbol returns false. 
    5455 * </p> 
    55  *  
     56 * 
     57 * @author Patrick Harms 
     58 * @param <V> the value type 
    5659 * @see SymbolComparator 
    57  *  
    58  * @author Patrick Harms 
    59  * @param <V> 
    6060 */ 
    6161class TaskSymbolBucketedMap<V> implements SymbolMap<ITaskInstance, V>, 
     
    6767         * entry, that is relevant. 
    6868         * </p> 
    69          *  
     69         * 
    7070         * @author Patrick Harms 
     71         * @param <T> the generic type 
    7172         */ 
    7273        private abstract class EntryFacade<T> { 
     
    9495         * task instances or only the values. 
    9596         * </p> 
    96          *  
     97         * 
    9798         * @author Patrick Harms 
     99         * @param <TYPE> the generic type 
    98100         */ 
    99101        private class ReadOnlyCollectionFacade<TYPE> implements Collection<TYPE> { 
    100102 
    101                 /** 
    102                  * the list facaded by this facade 
    103                  */ 
     103                /** the list facaded by this facade. */ 
    104104                private final List<Map.Entry<ITaskInstance, V>> list; 
    105105 
    106                 /** 
    107                  * the facade to be used for the entries 
    108                  */ 
     106                /** the facade to be used for the entries. */ 
    109107                private final EntryFacade<TYPE> entryFacade; 
    110108 
     
    113111                 * Initializes the facade with the facaded list and the facade to be 
    114112                 * used for the entries 
    115                  * </p> 
     113                 * </p>. 
     114                 * 
     115                 * @param list the list 
     116                 * @param entryFacade the entry facade 
    116117                 */ 
    117118                private ReadOnlyCollectionFacade( 
     
    299300         * of task instance entries. 
    300301         * </p> 
    301          *  
     302         * 
    302303         * @author Patrick Harms 
     304         * @param <TYPE> the generic type 
    303305         */ 
    304306        private class ReadOnlyCollectionIteratorFacade<TYPE> implements 
    305307                        Iterator<TYPE> { 
    306308 
    307                 /** 
    308                  * the facaded iterator 
    309                  */ 
     309                /** the facaded iterator. */ 
    310310                private final Iterator<Map.Entry<ITaskInstance, V>> iterator; 
    311311 
    312                 /** 
    313                  * the facade for the entries provided by the facaded iterator 
    314                  */ 
     312                /** the facade for the entries provided by the facaded iterator. */ 
    315313                private final EntryFacade<TYPE> entryFacade; 
    316314 
     
    320318                 * facade to be used for the entries. 
    321319                 * </p> 
     320                 * 
     321                 * @param iterator the iterator 
     322                 * @param entryFacade the entry facade 
    322323                 */ 
    323324                private ReadOnlyCollectionIteratorFacade( 
     
    385386         * <p> 
    386387         * Internally used data structure for storing task instance - value pairs 
    387          * </p> 
    388          *  
     388         * </p>. 
     389         * 
    389390         * @author Patrick Harms 
    390391         */ 
    391392        private class SymbolMapEntry implements Map.Entry<ITaskInstance, V> { 
    392393 
    393                 /** 
    394                  * the task instance to map to a value 
    395                  */ 
     394                /** the task instance to map to a value. */ 
    396395                private final ITaskInstance symbol; 
    397396 
    398                 /** 
    399                  * the value associated with the symbol 
    400                  */ 
     397                /** the value associated with the symbol. */ 
    401398                private V value; 
    402399 
     
    406403                 * and its associated value. 
    407404                 * </p> 
     405                 * 
     406                 * @param symbol the symbol 
     407                 * @param value the value 
    408408                 */ 
    409409                private SymbolMapEntry(ITaskInstance symbol, V value) { 
     
    507507        } 
    508508 
    509         /** 
    510          * <p> 
    511          * default serial version UID 
    512          * </p> 
    513          */ 
     509        /** <p> default serial version UID </p>. */ 
    514510        private static final long serialVersionUID = 1L; 
    515511 
     
    522518        private static final int MAX_LIST_SIZE = 15; 
    523519 
    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>. */ 
    529521        private final TaskInstanceComparator comparator; 
    530522 
    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>. */ 
    536524        private final List<Map.Entry<ITaskInstance, V>> symbolList; 
    537525 
     
    556544         * <p> 
    557545         * 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 
    565549         */ 
    566550        public TaskSymbolBucketedMap(TaskInstanceComparator comparator) { 
     
    576560         * <p> 
    577561         * 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 
    585565         */ 
    586566        public TaskSymbolBucketedMap(TaskSymbolBucketedMap<V> otherMap) { 
     
    608588         * should be used to ensure map behavior. 
    609589         * </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 
    616593         * @return as described 
    617          *  
    618          * @throws IllegalArgumentException 
    619          *             if the provided task instance is null 
    620594         */ 
    621595        @Override 
     
    648622         * id is shifted to another value. 
    649623         * </p> 
     624         * 
     625         * @param symbolEntry the symbol entry 
    650626         */ 
    651627        private void addToSymbolBucket(Map.Entry<ITaskInstance, V> symbolEntry) { 
     
    687663         * Returns true if the provided task instance was stored in this map. 
    688664         * </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 
    693667         * @return as described 
    694          *  
    695          * @throws IllegalArgumentException 
    696          *             if the provided task instance is null 
    697668         */ 
    698669        @Override 
     
    745716         * task instances, sequence instances, selection instances, and iteration 
    746717         * instances 
    747          * </p> 
     718         * </p>. 
     719         * 
     720         * @param taskInstance the task instance 
     721         * @return the bucket search order 
    748722         */ 
    749723        private int[] getBucketSearchOrder(ITaskInstance taskInstance) { 
     
    785759         * the other buckets are searched for the task instance. 
    786760         * </p> 
     761         * 
     762         * @param symbol the symbol 
     763         * @return the entry 
    787764         */ 
    788765        private Map.Entry<ITaskInstance, V> getEntry(ITaskInstance symbol) { 
     
    844821         * instance is not stored in this map, the method returns null. 
    845822         * </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 
    850825         * @return as described 
    851          *  
    852          * @throws IllegalArgumentException 
    853          *             if the provided task instance is null 
    854826         */ 
    855827        @Override 
     
    910882         * comparator. 
    911883         * </p> 
     884         * 
     885         * @param symbol the symbol 
     886         * @param list the list 
     887         * @return the map. entry 
    912888         */ 
    913889        private Map.Entry<ITaskInstance, V> lookup(ITaskInstance symbol, 
     
    928904         * possible. 
    929905         * </p> 
     906         * 
     907         * @param symbol the symbol 
     908         * @return the map. entry 
    930909         */ 
    931910        private Map.Entry<ITaskInstance, V> removeFromSymbolBuckets( 
     
    964943         * is removed. 
    965944         * </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 
    970947         * @return as described 
    971          *  
    972          * @throws IllegalArgumentException 
    973          *             if the provided task instance is null 
    974948         */ 
    975949        @Override 
     
    999973         * <p> 
    1000974         * Updates the default bucket id to a new one 
    1001          * </p> 
     975         * </p>. 
    1002976         */ 
    1003977        private void setNewDefaultBucketId() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TaskSymbolIdentityMap.java

    r1733 r1734  
    2323import de.ugoe.cs.autoquest.usageprofiles.SymbolMap; 
    2424 
     25// TODO: Auto-generated Javadoc 
    2526/** 
    2627 * <p> 
    2728 * symbol map implementation for task instances considering two task instances 
    2829 * as equal if their tasks are identical 
    29  * </p> 
    30  *  
     30 * </p>. 
     31 * 
    3132 * @author Patrick Harms 
     33 * @param <V> the value type 
    3234 */ 
    3335public class TaskSymbolIdentityMap<V> implements SymbolMap<ITaskInstance, V> { 
    3436 
    35         /** */ 
     37        /** The Constant serialVersionUID. */ 
    3638        private static final long serialVersionUID = 1L; 
    3739 
    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>. */ 
    4341        private final Map<ITask, V> delegate; 
    4442 
     
    5452         * <p> 
    5553         * initializes this map 
    56          * </p> 
     54         * </p>. 
    5755         */ 
    5856        public TaskSymbolIdentityMap() { 
     
    6462         * <p> 
    6563         * copy constructor 
    66          * </p> 
     64         * </p>. 
    6765         * 
    68          * @param other 
    69          *            the map to be copied 
     66         * @param other            the map to be copied 
    7067         */ 
    7168        public TaskSymbolIdentityMap(SymbolMap<ITaskInstance, V> other) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.java

    r1733 r1734  
    2929import de.ugoe.cs.util.console.Console; 
    3030 
     31// TODO: Auto-generated Javadoc 
    3132/** 
    3233 * TODO update comment 
     
    8586public class TemporalRelationshipRuleManager { 
    8687 
    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>. */ 
    9289        private final ITaskFactory taskFactory; 
    9390 
    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>. */ 
    9992        private final ITaskBuilder taskBuilder; 
    10093 
     
    120113         * <p> 
    121114         * 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 
    126118         *            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 
    129120         *            during rule application 
    130121         */ 
     
    147138         * parameter is always true. 
    148139         * </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 
    157144         *            depending on the recursion depth of calling this method. 
     145         * @return the int 
    158146         */ 
    159147        private int applyRules(ISessionScopeRule[] rules, 
     
    209197         * parameter is always true. 
    210198         * </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 
    219203         *            depending on the recursion depth of calling this method. 
     204         * @return the int 
    220205         */ 
    221206        private int applyRules(ITaskInstanceScopeRule[] rules, 
     
    267252         * the rule application. 
    268253         * </p> 
    269          *  
    270          * @param taskFactory 
    271          *            the task factory to be used for instantiating new tasks. 
     254         * 
     255         * @param sessions the sessions 
    272256         */ 
    273257        public void applyRules(List<IUserSession> sessions) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/DefaultTaskInstanceTraversingVisitor.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
    1920 * Default implementation for a task instance visitor performing a traversal of 
    2021 * the instances 
    21  * </p> 
    22  *  
     22 * </p>. 
     23 * 
    2324 * @author Patrick Harms 
    2425 */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/DefaultTaskTraversingVisitor.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
    1920 * Default implementation for a task visitor performing a traversal of the task 
    20  * </p> 
    21  *  
     21 * </p>. 
     22 * 
    2223 * @author Patrick Harms 
    2324 */ 
     
    4950         * <p> 
    5051         * 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 
    5555         */ 
    5656        public void visit(IMarkingTemporalRelationship relationship) { 
     
    9494         * <p> 
    9595         * 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 
    10099         */ 
    101100        public void visit(IStructuringTemporalRelationship relationship) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IEventTask.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IEventTaskInstance.java

    r1733 r1734  
    1717import de.ugoe.cs.autoquest.eventcore.Event; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
     
    4142         * <p> 
    4243         * returns the event represented by this event task instance 
    43          * </p> 
    44          *  
     44         * </p>. 
     45         * 
    4546         * @return as described 
    4647         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IIteration.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IIterationInstance.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    3031         * clones this task instance by creating exact clones of each contained 
    3132         * instance in their order 
    32          * </p> 
    33          *  
     33         * </p>. 
     34         * 
    3435         * @return a clone of the task instance list 
    3536         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IMarkingTemporalRelationship.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IOptional.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IOptionalInstance.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    3132         * clones this task instance by creating exact clones of each contained 
    3233         * instance 
    33          * </p> 
    34          *  
     34         * </p>. 
     35         * 
    3536         * @return a clone of the task instance 
    3637         */ 
     
    4243         * returns the child of the optional of null if the optional was not 
    4344         * executed 
    44          * </p> 
    45          *  
     45         * </p>. 
     46         * 
    4647         * @return as described 
    4748         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISelection.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISelectionInstance.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    2930         * clones this task instance by creating exact clones of the contained 
    3031         * instance 
    31          * </p> 
    32          *  
     32         * </p>. 
     33         * 
    3334         * @return a clone of the task instance 
    3435         */ 
     
    3940         * <p> 
    4041         * returns the selected child of the selection 
    41          * </p> 
    42          *  
     42         * </p>. 
     43         * 
    4344         * @return as described 
    4445         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISequence.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ISequenceInstance.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    2930         * clones this task instance by creating exact clones of each contained 
    3031         * instance in their order 
    31          * </p> 
    32          *  
     32         * </p>. 
     33         * 
    3334         * @return a clone of the task instance 
    3435         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IStructuringTemporalRelationship.java

    r1733 r1734  
    1717import java.util.List; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITask.java

    r1733 r1734  
    1818import java.util.Collection; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    6364         * of it. 
    6465         * </p> 
    65          *  
     66         * 
     67         * @param task the task 
    6668         * @return as described 
    6769         */ 
     
    101103         * <p> 
    102104         * returns a collection of all observed instances of this task 
    103          * </p> 
    104          *  
     105         * </p>. 
     106         * 
    105107         * @return as described 
    106108         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskBuilder.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    4546         * <p> 
    4647         * 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 
    5352         */ 
    5453        void addChild(ISelection parent, ITask child); 
     
    5756         * <p> 
    5857         * 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 
    7064         */ 
    7165        void addChild(ISequence parent, int index, ITask child) 
     
    7569         * <p> 
    7670         * 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 
    8375         */ 
    8476        void addChild(ISequence parent, ITask child); 
     
    10597         * <p> 
    10698         * 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 
    113103         */ 
    114104        void addExecutedTask(IUserSession session, ITaskInstance taskInstance); 
     
    136126         * <p> 
    137127         * 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 
    144132         */ 
    145133        void addTaskInstance(ITaskInstanceList taskInstanceList, 
     
    162150         * <p> 
    163151         * 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 
    173157         */ 
    174158        void removeChild(ISequence parent, int index) 
     
    178162         * <p> 
    179163         * 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 
    189169         */ 
    190170        void removeTaskInstance(ITaskInstanceList taskInstanceList, int index) 
     
    196176         * the child is not found (comparison using equals). 
    197177         * </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 
    208182         */ 
    209183        void replaceChild(ISelection parent, ITask oldChild, ITask newChild); 
     
    248222         * <p> 
    249223         * 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 
    261230         */ 
    262231        void setChild(ISequence parent, int index, ITask child) 
     
    266235         * <p> 
    267236         * 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 
    274241         */ 
    275242        void setMarkedTask(IIteration iteration, ITask child); 
     
    278245         * <p> 
    279246         * 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 
    286251         */ 
    287252        void setMarkedTask(IOptional optional, ITask child); 
     
    290255         * <p> 
    291256         * 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 
    298261         */ 
    299262        void setTask(ITaskInstance taskInstance, ITask task); 
     
    302265         * <p> 
    303266         * 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 
    315273         */ 
    316274        void setTaskInstance(ITaskInstanceList taskInstanceList, int index, 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskFactory.java

    r1733 r1734  
    1919import de.ugoe.cs.autoquest.eventcore.Event; 
    2020 
     21// TODO: Auto-generated Javadoc 
    2122/** 
    2223 * <p> 
    2324 * factory for the different task types 
    24  * </p> 
    25  *  
     25 * </p>. 
     26 * 
    2627 * @author Patrick Harms 
    2728 */ 
     
    3132         * <p> 
    3233         * 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 
    3837         * @return the event task 
    3938         */ 
     
    4342         * <p> 
    4443         * creates a new empty iteration 
    45          * </p> 
    46          *  
     44         * </p>. 
     45         * 
    4746         * @return the iteration 
    4847         */ 
     
    5251         * <p> 
    5352         * creates a new empty optional 
    54          * </p> 
    55          *  
     53         * </p>. 
     54         * 
    5655         * @return the optional 
    5756         */ 
     
    6160         * <p> 
    6261         * creates a new empty selection 
    63          * </p> 
    64          *  
     62         * </p>. 
     63         * 
    6564         * @return the selection 
    6665         */ 
     
    7069         * <p> 
    7170         * creates a new empty sequence 
    72          * </p> 
    73          *  
     71         * </p>. 
     72         * 
    7473         * @return the sequence 
    7574         */ 
     
    8079         * creates a new task instance with the given task as its model representing 
    8180         * 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 
    8985         * @return the task instance 
    9086         */ 
     
    9490         * <p> 
    9591         * 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 
    10195         * @return the task instance 
    10296         */ 
     
    106100         * <p> 
    107101         * 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 
    113105         * @return the task instance 
    114106         */ 
     
    118110         * <p> 
    119111         * 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 
    125115         * @return the task instance 
    126116         */ 
     
    130120         * <p> 
    131121         * 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 
    137125         * @return the task instance 
    138126         */ 
     
    142130         * <p> 
    143131         * 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 
    149135         * @return the task model 
    150136         */ 
     
    154140         * <p> 
    155141         * creates a new empty user session 
    156          * </p> 
    157          *  
     142         * </p>. 
     143         * 
    158144         * @return the user session 
    159145         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInfo.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
     
    2930         * <p> 
    3031         * represents a measure for a specific metric 
    31          * </p> 
    32          *  
     32         * </p>. 
     33         * 
    3334         * @author Patrick Harms 
    3435         */ 
     
    3839                 * <p> 
    3940                 * returns the metric of the measure 
    40                  * </p> 
    41                  *  
     41                 * </p>. 
     42                 * 
    4243                 * @return as described 
    4344                 */ 
     
    4748                 * <p> 
    4849                 * returns the value of the measure 
    49                  * </p> 
    50                  *  
     50                 * </p>. 
     51                 * 
    5152                 * @return as described 
    5253                 */ 
     
    5859                 * specific context, i.e. parent task 
    5960                 * </p> 
    60                  *  
     61                 * 
     62                 * @param context the context 
    6163                 * @return as described 
    6264                 */ 
     
    6870         * <p> 
    6971         * returns all available measures 
    70          * </p> 
    71          *  
     72         * </p>. 
     73         * 
    7274         * @return as described 
    7375         */ 
     
    7779         * <p> 
    7880         * returns the value of the measure identified through the given metric 
    79          * </p> 
     81         * </p>. 
    8082         * 
    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 
    8484         * @return as described 
    8585         */ 
     
    105105         * <p> 
    106106         * returns the task to which these infos belong 
    107          * </p> 
    108          *  
     107         * </p>. 
     108         * 
    109109         * @return as described 
    110110         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstance.java

    r1733 r1734  
    1717import java.io.Serializable; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
     
    7677         * returns a hash code for the task instance to be able to put it into hash 
    7778         * maps 
    78          * </p> 
    79          *  
     79         * </p>. 
     80         * 
    8081         * @return as described 
    8182         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstanceList.java

    r1733 r1734  
    1717import java.io.Serializable; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskInstanceVisitor.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskModel.java

    r1733 r1734  
    1919import java.util.List; 
    2020 
     21// TODO: Auto-generated Javadoc 
    2122/** 
    2223 * <p> 
     
    4546         * returns a list of all metrics calculated by this model for the tasks and 
    4647         * stored in the respective task infos 
    47          * </p> 
     48         * </p>. 
    4849         * 
    4950         * @return as described 
     
    5657         * if the provided task does not belong to the model. 
    5758         * </p> 
    58          *  
     59         * 
     60         * @param task the task 
    5961         * @return as described 
    6062         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITaskVisitor.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/ITemporalRelationship.java

    r1733 r1734  
    1515package de.ugoe.cs.autoquest.tasktrees.treeifc; 
    1616 
     17// TODO: Auto-generated Javadoc 
    1718/** 
    1819 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/IUserSession.java

    r1733 r1734  
    1717import java.util.List; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
     
    3334         * clones a user session by creating exact clones of each contained instance 
    3435         * in their order 
    35          * </p> 
    36          *  
     36         * </p>. 
     37         * 
    3738         * @return a clone of the session 
    3839         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/TaskMetric.java

    r1733 r1734  
    1717import java.text.DecimalFormat; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
     
    2829public enum TaskMetric { 
    2930 
    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( 
    3134                        "depth", 
    3235                        "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( 
    3439                        "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( 
    3643                        "event coverage ratio", 
    3744                        "the ratio of events covered by this task in relation to all events " 
    3845                                        + "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", 
    4049                        "the quantile of with respect to all event coverages begining with " 
    4150                                        + "the lowest", 0.1, "%"); 
    4251 
    43         /** 
    44          * <p> 
    45          * the name of the metric 
    46          * </p> 
    47          */ 
     52        /** <p> the name of the metric </p>. */ 
    4853        private String name; 
    4954 
    50         /** 
    51          * <p> 
    52          * a human readable description of the metric 
    53          * </p> 
    54          */ 
     55        /** <p> a human readable description of the metric </p>. */ 
    5556        private String description; 
    5657 
    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>. */ 
    6259        private double formatScale; 
    6360 
    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>. */ 
    6962        private String formatUnit; 
    7063 
     
    7265         * <p> 
    7366         * initializes the metric with a name and a description 
    74          * </p> 
     67         * </p>. 
     68         * 
     69         * @param name the name 
     70         * @param description the description 
    7571         */ 
    7672        private TaskMetric(String name, String description) { 
     
    8682         * scale and a unit for formatting it. 
    8783         * </p> 
     84         * 
     85         * @param name the name 
     86         * @param description the description 
     87         * @param formatScale the format scale 
     88         * @param formatUnit the format unit 
    8889         */ 
    8990        private TaskMetric(String name, String description, double formatScale, 
     
    100101         * format scale and unit. 
    101102         * </p> 
    102          *  
     103         * 
     104         * @param value the value 
    103105         * @return the formatted value depending on the scale and unit of the metric 
    104106         */ 
     
    124126         * <p> 
    125127         * returns the human readable description of the metric 
    126          * </p> 
    127          *  
     128         * </p>. 
     129         * 
    128130         * @return the human readable description of the metric 
    129131         */ 
     
    135137         * <p> 
    136138         * returns the name of the metric 
    137          * </p> 
    138          *  
     139         * </p>. 
     140         * 
    139141         * @return the name of the metric 
    140142         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/EventTask.java

    r1733 r1734  
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    2829class EventTask extends Task implements IEventTask { 
    2930 
    30         /** 
    31          * <p> 
    32          * default serial version UID 
    33          * </p> 
    34          */ 
     31        /** <p> default serial version UID </p>. */ 
    3532        private static final long serialVersionUID = 1L; 
    3633 
     
    3936         * simple constructor initializing this task with a description for the 
    4037         * 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 
    4541         */ 
    4642        EventTask(String type) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/EventTaskInstance.java

    r1733 r1734  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2020 
     21// TODO: Auto-generated Javadoc 
    2122/** 
    2223 * <p> 
     
    2829class EventTaskInstance extends TaskInstance implements IEventTaskInstance { 
    2930 
    30         /** 
    31          * <p> 
    32          * default serial version UID 
    33          * </p> 
    34          */ 
     31        /** <p> default serial version UID </p>. */ 
    3532        private static final long serialVersionUID = 1L; 
    3633 
    37         /** 
    38          * <p> 
    39          * the event represented by this instance 
    40          * </p> 
    41          */ 
     34        /** <p> the event represented by this instance </p>. */ 
    4235        private final Event event; 
    4336 
     
    4639         * initializes this instance with the respective task model and the 
    4740         * represented event 
    48          * </p> 
     41         * </p>. 
    4942         * 
    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 
    5445         */ 
    5546        EventTaskInstance(IEventTask task, Event event) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Iteration.java

    r1733 r1734  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2020 
     21// TODO: Auto-generated Javadoc 
    2122/** 
    2223 * <p> 
     
    2930class Iteration extends MarkingTemporalRelationship implements IIteration { 
    3031 
    31         /** 
    32          * <p> 
    33          * default serial version UID 
    34          * </p> 
    35          */ 
     32        /** <p> default serial version UID </p>. */ 
    3633        private static final long serialVersionUID = 1L; 
    3734 
     
    4037         * simple constructor providing the base class with a human readable name of 
    4138         * the type of this task 
    42          * </p> 
     39         * </p>. 
    4340         */ 
    4441        Iteration() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/IterationInstance.java

    r1733 r1734  
    2424import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2525 
     26// TODO: Auto-generated Javadoc 
    2627/** 
    2728 * <p> 
     
    3334class IterationInstance extends TaskInstance implements IIterationInstance { 
    3435 
    35         /** 
    36          * <p> 
    37          * default serial version UID 
    38          * </p> 
    39          */ 
     36        /** <p> default serial version UID </p>. */ 
    4037        private static final long serialVersionUID = 1L; 
    4138 
    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>. */ 
    4740        private List<ITaskInstance> children; 
    4841 
     
    5043         * <p> 
    5144         * initializes this instance with the respective task model 
    52          * </p> 
     45         * </p>. 
    5346         * 
    54          * @param task 
    55          *            the task of which this is an instance 
     47         * @param task            the task of which this is an instance 
    5648         */ 
    5749        IterationInstance(IIteration task) { 
     
    6254         * <p> 
    6355         * 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 
    7060         */ 
    7161        synchronized void addChild(int index, ITaskInstance child) { 
     
    8070         * <p> 
    8171         * 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 
    8675         */ 
    8776        synchronized void addChild(ITaskInstance child) { 
     
    132121         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance#getChildren() 
    133122         */ 
     123        /** 
     124         * Gets the children. 
     125         * 
     126         * @return the children 
     127         */ 
    134128        public synchronized List<ITaskInstance> getChildren() { 
    135129                if (children == null) { 
     
    164158         * <p> 
    165159         * 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 
    171163         * @return the child removed from the children of this instance 
    172164         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/MarkingTemporalRelationship.java

    r1733 r1734  
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    3031                IMarkingTemporalRelationship { 
    3132 
    32         /** 
    33          * <p> 
    34          * default serial version UID 
    35          * </p> 
    36          */ 
     33        /** <p> default serial version UID </p>. */ 
    3734        private static final long serialVersionUID = 1L; 
    3835 
    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>. */ 
    4437        private ITask markedTask; 
    4538 
     
    4740         * <p> 
    4841         * initializes this temporal relationship with a human readable name 
    49          * </p> 
     42         * </p>. 
    5043         * 
    51          * @param relationshipType 
    52          *            the human readable name of this temporal relationship 
     44         * @param relationshipType            the human readable name of this temporal relationship 
    5345         */ 
    5446        MarkingTemporalRelationship(String relationshipType) { 
     
    9284         * <p> 
    9385         * 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 
    9889         */ 
    9990        protected void setMarkedTask(ITask markedTask) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Optional.java

    r1733 r1734  
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    2829class Optional extends MarkingTemporalRelationship implements IOptional { 
    2930 
    30         /** 
    31          * <p> 
    32          * default serial version UID 
    33          * </p> 
    34          */ 
     31        /** <p> default serial version UID </p>. */ 
    3532        private static final long serialVersionUID = 1L; 
    3633 
     
    3936         * simple constructor providing the base class with a human readable name of 
    4037         * the type of this task 
    41          * </p> 
     38         * </p>. 
    4239         */ 
    4340        Optional() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/OptionalInstance.java

    r1733 r1734  
    2020import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2121 
     22// TODO: Auto-generated Javadoc 
    2223/** 
    2324 * <p> 
     
    2930class OptionalInstance extends TaskInstance implements IOptionalInstance { 
    3031 
    31         /** 
    32          * <p> 
    33          * default serial version UID 
    34          * </p> 
    35          */ 
     32        /** <p> default serial version UID </p>. */ 
    3633        private static final long serialVersionUID = 1L; 
    3734 
    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>. */ 
    4336        private ITaskInstance child; 
    4437 
     
    4639         * <p> 
    4740         * initializes this instance with the respective task model 
    48          * </p> 
     41         * </p>. 
    4942         * 
    50          * @param task 
    51          *            the task of which this is an instance 
     43         * @param task            the task of which this is an instance 
    5244         */ 
    5345        OptionalInstance(ITask task) { 
     
    9587         * <p> 
    9688         * 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 
    10192         */ 
    10293        void setChild(ITaskInstance child) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Selection.java

    r1733 r1734  
    1818import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    1919 
     20// TODO: Auto-generated Javadoc 
    2021/** 
    2122 * <p> 
     
    2829class Selection extends StructuringTemporalRelationship implements ISelection { 
    2930 
    30         /** 
    31          * <p> 
    32          * default serial version UID 
    33          * </p> 
    34          */ 
     31        /** <p> default serial version UID </p>. */ 
    3532        private static final long serialVersionUID = 1L; 
    3633 
     
    3936         * simple constructor providing the base class with a human readable name of 
    4037         * the type of this task 
    41          * </p> 
     38         * </p>. 
    4239         */ 
    4340        Selection() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/SelectionInstance.java

    r1733 r1734  
    2020import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2121 
     22// TODO: Auto-generated Javadoc 
    2223/** 
    2324 * <p> 
     
    2930class SelectionInstance extends TaskInstance implements ISelectionInstance { 
    3031 
    31         /** 
    32          * <p> 
    33          * default serial version UID 
    34          * </p> 
    35          */ 
     32        /** <p> default serial version UID </p>. */ 
    3633        private static final long serialVersionUID = 1L; 
    3734 
    38         /** 
    39          * <p> 
    40          * the child of this task instance 
    41          * </p> 
    42          */ 
     35        /** <p> the child of this task instance </p>. */ 
    4336        private ITaskInstance child; 
    4437 
     
    4639         * <p> 
    4740         * initializes this instance with the respective task model 
    48          * </p> 
     41         * </p>. 
    4942         * 
    50          * @param task 
    51          *            the task of which this is an instance 
     43         * @param task            the task of which this is an instance 
    5244         */ 
    5345        SelectionInstance(ITask task) { 
     
    9587         * <p> 
    9688         * 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 
    10192         */ 
    10293        void setChild(ITaskInstance child) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Sequence.java

    r1733 r1734  
    1717import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    1818 
     19// TODO: Auto-generated Javadoc 
    1920/** 
    2021 * <p> 
     
    2728class Sequence extends StructuringTemporalRelationship implements ISequence { 
    2829 
    29         /** 
    30          * <p> 
    31          * default serial version UID 
    32          * </p> 
    33          */ 
     30        /** <p> default serial version UID </p>. */ 
    3431        private static final long serialVersionUID = 1L; 
    3532 
     
    3835         * simple constructor providing the base class with a human readable name of 
    3936         * the type of this task 
    40          * </p> 
     37         * </p>. 
    4138         */ 
    4239        Sequence() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/SequenceInstance.java

    r1733 r1734  
    2525import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
    2626 
     27// TODO: Auto-generated Javadoc 
    2728/** 
    2829 * <p> 
     
    3435class SequenceInstance extends TaskInstance implements ISequenceInstance { 
    3536 
    36         /** 
    37          * <p> 
    38          * default serial version UID 
    39          * </p> 
    40          */ 
     37        /** <p> default serial version UID </p>. */ 
    4138        private static final long serialVersionUID = 1L; 
    4239 
    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>. */ 
    4841        private List<ITaskInstance> children; 
    4942 
     
    5144         * <p> 
    5245         * initializes this instance with the respective task model 
    53          * </p> 
     46         * </p>. 
    5447         * 
    55          * @param task 
    56          *            the task of which this is an instance 
     48         * @param task            the task of which this is an instance 
    5749         */ 
    5850        SequenceInstance(ISequence task) { 
     
    6355         * <p> 
    6456         * 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 
    7161         */ 
    7262        synchronized void addChild(int index, ITaskInstance child) { 
     
    8171         * <p> 
    8272         * 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 
    8776         */ 
    8877        synchronized void addChild(ITaskInstance child) { 
     
    133122         * @see de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance#getChildren() 
    134123         */ 
     124        /** 
     125         * Gets the children. 
     126         * 
     127         * @return the children 
     128         */ 
    135129        public synchronized List<ITaskInstance> getChildren() { 
    136130                if (children == null) { 
     
    165159         * <p> 
    166160         * 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 
    172164         * @return the child removed from the children of this instance 
    173165         */ 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/StructuringTemporalRelationship.java

    r1733 r1734  
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2222 
     23// TODO: Auto-generated Javadoc 
    2324/** 
    2425 * <p> 
     
    3334                IStructuringTemporalRelationship { 
    3435 
    35         /** 
    36          * <p> 
    37          * default serial version UID 
    38          * </p> 
    39          */ 
     36        /** <p> default serial version UID </p>. */ 
    4037        private static final long serialVersionUID = 1L; 
    4138 
    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>. */ 
    4740        private List<ITask> children = new LinkedList<ITask>(); 
    4841 
     
    5043         * <p> 
    5144         * initializes this temporal relationship with a human readable name 
    52          * </p> 
     45         * </p>. 
    5346         * 
    54          * @param relationshipType 
    55          *            the human readable name of this temporal relationship 
     47         * @param relationshipType            the human readable name of this temporal relationship 
    5648         */ 
    5749        StructuringTemporalRelationship(String relationshipType) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/Task.java

    r1733 r1734  
    3030import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskVisitor; 
    3131 
     32// TODO: Auto-generated Javadoc 
    3233/** 
    3334 * <p> 
     
    5859        } 
    5960 
    60         /** 
    61          * <p> 
    62          * default serial version UID 
    63          * </p> 
    64          */ 
     61        /** <p> default serial version UID </p>. */ 
    6562        private static final long serialVersionUID = 1L; 
    6663 
     
    8178        private final int id; 
    8279 
    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>. */ 
    8881        private final String type; 
    8982 
    90         /** 
    91          * <p> 
    92          * a human readable description of the task 
    93          * </p> 
    94          */ 
     83        /** <p> a human readable description of the task </p>. */ 
    9584        private String description; 
    9685 
    97         /** 
    98          * <p> 
    99          * the instances of this task 
    100          * </p> 
    101          */ 
     86        /** <p> the instances of this task </p>. */ 
    10287        private final Collection<ITaskInstance> instances = new HashSet<ITaskInstance>(); 
    10388 
    104         /** 
    105          * <p> 
    106          * the execution variants of this task 
    107          * </p> 
    108          */ 
     89        /** <p> the execution variants of this task </p>. */ 
    10990        private Collection<Collection<ITaskInstance>> executionVariants; 
    11091 
     
    11495         * {@link #getNewId()} method 
    11596         * </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 
    12299         */ 
    123100        Task(String type) { 
     
    143120         * <p> 
    144121         * 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 
    149125         */ 
    150126        synchronized void addInstance(ITaskInstance instance) { 
     
    172148 
    173149        /** 
    174          * 
     150         * Determine execution variants. 
     151         * 
     152         * @param executionVariants the execution variants 
    175153         */ 
    176154        private void determineExecutionVariants( 
     
    273251 
    274252        /** 
    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 
    276258         */ 
    277259        private boolean isSameExecution(ITaskInstance instance1, 
     
    327309 
    328310        /** 
    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 
    330316         */ 
    331317        private boolean isSameExecutionList(ITaskInstanceList list1, 
     
    347333         * <p> 
    348334         * 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 
    353338         */ 
    354339        synchronized void removeInstance(ITaskInstance instance) { 
     
    360345         * <p> 
    361346         * 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 
    366350         */ 
    367351        void setDescription(String description) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskBuilder.java

    r1733 r1734  
    3333import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
    3434 
     35// TODO: Auto-generated Javadoc 
    3536/** 
    3637 * <p> 
     
    5152         * @see ITaskBuilder#addChild(IIterationInstance, int, ITaskInstance) 
    5253         */ 
     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         */ 
    5362        public void addChild(IIterationInstance instance, int index, 
    5463                        ITaskInstance child) throws IllegalArgumentException { 
     
    170179         *  
    171180         * @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 
    172189         */ 
    173190        public void addChild(ISequenceInstance instance, int index, 
     
    247264         * relationship including a check for the child type. 
    248265         * </p> 
     266         * 
     267         * @param parent the parent 
     268         * @param index the index 
     269         * @param child the child 
    249270         */ 
    250271        private void addChildInternal(StructuringTemporalRelationship parent, 
     
    266287         *  
    267288         * @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 
    268296         */ 
    269297        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  
    3232import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
    3333 
     34// TODO: Auto-generated Javadoc 
    3435/** 
    3536 * <p> 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskInfo.java

    r1733 r1734  
    2222import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric; 
    2323 
     24// TODO: Auto-generated Javadoc 
    2425/** 
    2526 * <p> 
     
    4243        private static class Measure implements IMeasure { 
    4344 
    44                 /** 
    45                  * <p> 
    46                  * the metric to which the measure belongs 
    47                  * </p> 
    48                  */ 
     45                /** <p> the metric to which the measure belongs </p>. */ 
    4946                private final TaskMetric metric; 
    5047 
    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>. */ 
    5649                private HashMap<ITask, Integer> values; 
    5750 
    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>. */ 
    6352                private int contextFreeValue = 0; 
    6453 
     
    6655                 * <p> 
    6756                 * initializes the measure with a specific metric 
    68                  * </p> 
     57                 * </p>. 
     58                 * 
     59                 * @param metric the metric 
    6960                 */ 
    7061                private Measure(TaskMetric metric) { 
     
    119110                 * increases the value of the measure context free as well as specific 
    120111                 * to the provided context according to the provided increment 
    121                  * </p> 
     112                 * </p>. 
     113                 * 
     114                 * @param context the context 
     115                 * @param increment the increment 
    122116                 */ 
    123117                private void increase(ITask context, int increment) { 
     
    143137                 * sets the value of the measure context free as well as specific to the 
    144138                 * provided context 
    145                  * </p> 
     139                 * </p>. 
     140                 * 
     141                 * @param context the context 
     142                 * @param value the value 
    146143                 */ 
    147144                private void set(ITask context, int value) { 
     
    159156        } 
    160157 
    161         /** 
    162          * <p> 
    163          * the task to which the infos belong 
    164          * </p> 
    165          */ 
     158        /** <p> the task to which the infos belong </p>. */ 
    166159        private final ITask task; 
    167160 
    168         /** 
    169          * <p> 
    170          * all available measures for the task 
    171          * </p> 
    172          */ 
     161        /** <p> all available measures for the task </p>. */ 
    173162        private final ArrayList<Measure> measures = new ArrayList<Measure>(); 
    174163 
     
    177166         * initialized the task infos with the task to which they belong. 
    178167         * </p> 
    179          *  
    180          * @param task 
     168         * 
     169         * @param task the task 
    181170         */ 
    182171        TaskInfo(ITask task) { 
     
    209198         * convenience method to internally determine the measure for a specific 
    210199         * metric 
    211          * </p> 
     200         * </p>. 
     201         * 
     202         * @param metric the metric 
     203         * @return the measure 
    212204         */ 
    213205        private Measure getMeasure(TaskMetric metric) { 
     
    282274         * increases a specific value for a measure of a specific metric in the 
    283275         * 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 
    292281         */ 
    293282        void increaseCount(TaskMetric metric, ITask context, int increment) { 
     
    307296         * sets a specific value for a measure of a specific metric in the provided 
    308297         * 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 
    317303         */ 
    318304        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  
    1919import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceVisitor; 
    2020 
     21// TODO: Auto-generated Javadoc 
    2122/** 
    2223 * <p> 
     
    4748        } 
    4849 
    49         /** 
    50          * <p> 
    51          * default serial version UID 
    52          * </p> 
    53          */ 
     50        /** <p> default serial version UID </p>. */ 
    5451        private static final long serialVersionUID = 1L; 
    5552 
     
    6259        private static int temporalId = 0; 
    6360 
    64         /** 
    65          * <p> 
    66          * the task instantiated by this task instance 
    67          * </p> 
    68          */ 
     61        /** <p> the task instantiated by this task instance </p>. */ 
    6962        private ITask task; 
    7063 
     
    8376         * {@link #getNewId()}. 
    8477         * </p> 
     78         * 
     79         * @param task the task 
    8580         */ 
    8681        TaskInstance(ITask task) { 
     
    156151         * <p> 
    157152         * 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 
    162156         */ 
    163157        void setTask(ITask task) { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskModel.java

    r1733 r1734  
    4040import de.ugoe.cs.autoquest.tasktrees.treeifc.TaskMetric; 
    4141 
     42// TODO: Auto-generated Javadoc 
    4243/** 
    4344 * <p> 
     
    6364        private static class TaskModelIndex { 
    6465 
    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>. */ 
    7167                private final Map<ITask, TaskInfo> taskMap = new HashMap<ITask, TaskInfo>(); 
    7268 
     
    7571                 * internal convenience method to build the task model during 
    7672                 * initialization 
    77                  * </p> 
     73                 * </p>. 
     74                 * 
     75                 * @param task the task 
     76                 * @param context the context 
    7877                 */ 
    7978                private void ensureTaskInfo(ITask task, ITask context) { 
     
    101100                 * to the parameters. 
    102101                 * </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 
    103107                 */ 
    104108                private void ensureTaskInfo(ITask task, ITask context, 
     
    126130                 * <p> 
    127131                 * 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 
    129136                 */ 
    130137                private int getDepth(ITask task) { 
     
    151158                 * called on initialization to fill the index with infos about the given 
    152159                 * 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[] 
    154165                 */ 
    155166                private int[] handleTaskInstance(ITaskInstance taskInstance, 
     
    235246        } 
    236247 
    237         /** 
    238          * <p> 
    239          * default serial version UID 
    240          * </p> 
    241          */ 
     248        /** <p> default serial version UID </p>. */ 
    242249        private static final long serialVersionUID = 1L; 
    243250 
    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>. */ 
    249252        private static final TaskMetric[] taskMetrics = new TaskMetric[] { 
    250253                        TaskMetric.COUNT, TaskMetric.DEPTH, TaskMetric.EVENT_COVERAGE, 
    251254                        TaskMetric.EVENT_COVERAGE_RATIO, TaskMetric.EVENT_COVERAGE_QUANTILE }; 
    252255 
    253         /** 
    254          * <p> 
    255          * the user sessions belonging to the model 
    256          * </p> 
    257          */ 
     256        /** <p> the user sessions belonging to the model </p>. */ 
    258257        private final List<IUserSession> userSessions; 
    259258 
    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>. */ 
    266260        private transient TaskModelIndex index = null; 
    267261 
     
    270264         * initializes the task model with the user sessions out of which the tasks 
    271265         * are extracted 
    272          * </p> 
    273          *  
    274          * @param userSessions 
    275          *            as described 
     266         * </p>. 
     267         * 
     268         * @param userSessions            as described 
    276269         */ 
    277270        TaskModel(List<IUserSession> userSessions) { 
     
    297290         * internal convenience method that initializes the internal index and 
    298291         * calculates all measures for metrics available for the tasks 
    299          * </p> 
     292         * </p>. 
    300293         */ 
    301294        private synchronized void ensureInitialized() { 
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/UserSession.java

    r1733 r1734  
    2424import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
    2525 
     26// TODO: Auto-generated Javadoc 
    2627/** 
    2728 * <p> 
     
    3435class UserSession implements IUserSession { 
    3536 
    36         /** 
    37          * <p> 
    38          * default serial version UID 
    39          * </p> 
    40          */ 
     37        /** <p> default serial version UID </p>. */ 
    4138        private static final long serialVersionUID = 1L; 
    4239 
    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>. */ 
    4841        private List<ITaskInstance> executedTasks = new ArrayList<ITaskInstance>(); 
    4942 
     
    5245         * used internally to add a task instance to the user session at a specific 
    5346         * 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 
    6051         */ 
    6152        void addExecutedTask(int index, ITaskInstance taskInstance) { 
     
    6657         * <p> 
    6758         * 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 
    7262         */ 
    7363        void addExecutedTask(ITaskInstance taskInstance) { 
     
    159149         * <p> 
    160150         * 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 
    165154         */ 
    166155        void removeExecutedTask(int index) { 
Note: See TracChangeset for help on using the changeset viewer.