Changeset 1655 for branches/autoquest-core-tasktrees-alignment/src/main
- Timestamp:
- 08/09/14 17:40:11 (10 years ago)
- Location:
- branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/Match.java
r1654 r1655 60 60 } 61 61 62 /*62 63 63 public void addOccurencesOf(Match m) { 64 LinkedList<MatchOccurence> occ = m.getOccurences(); 65 occurences.addAll(occ); 64 occurences.addAll(m.getOccurences()); 66 65 } 67 */66 68 67 69 68 -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/PairwiseAlignmentGenerator.java
r1630 r1655 31 31 smithWatermanThreshold); 32 32 alignments.set(i, j, aa); 33 33 //TODO: This is old code used for generating pairwise distances between alignments (to build 34 // a guide tree 35 /* 34 36 AlignmentAlgorithm sameSequence1 = AlignmentAlgorithmFactory 35 37 .create(); … … 45 47 .shuffle(), submat, 46 48 smithWatermanThreshold); 47 49 48 50 // Score of the aligmnment 49 51 double score = alignments.get(i, j).getAlignmentScore(); … … 69 71 } 70 72 } 73 */ 71 74 } 72 75 } -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/RuleUtils.java
r1654 r1655 17 17 import java.util.Iterator; 18 18 19 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 20 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 19 21 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 20 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 23 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 21 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 22 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; … … 32 35 */ 33 36 class RuleUtils { 34 35 /**36 * <p>37 * counter for generating unique ids. Starts at 0 for each new program start38 * </p>39 */40 private static int idCounter = 0;41 37 42 /** 43 * <p> 44 * generates a sub sequence for a specified range of elements in the provided task instances 45 * list. 46 * </p> 47 * 48 * @param parent the list of which the range shall be extracted 49 * @param startIndex the start index of the range 50 * @param endIndex the end index of the range (inclusive) 51 * @param model the task model (required for instantiating the sub sequence) 52 * @param taskFactory the task factory used for instantiating the sub sequence 53 * @param taskBuilder the task builder to perform changes in the task structure 54 * 55 * @return a task instance representing the requested sub sequence 56 */ 57 static ITaskInstance getSubSequenceInRange(ITaskInstanceList parent, 58 int startIndex, 59 int endIndex, 60 ISequence model, 61 ITaskFactory taskFactory, 62 ITaskBuilder taskBuilder) 63 { 64 ISequenceInstance subsequence = taskFactory.createNewTaskInstance(model); 38 /** 39 * <p> 40 * counter for generating unique ids. Starts at 0 for each new program start 41 * </p> 42 */ 43 private static int idCounter = 0; 65 44 66 for (int i = startIndex; i <= endIndex; i++) { 67 taskBuilder.addChild(subsequence, parent.get(i)); 68 } 45 /** 46 * <p> 47 * generates a sub sequence for a specified range of elements in the 48 * provided task instances list. 49 * </p> 50 * 51 * @param parent 52 * the list of which the range shall be extracted 53 * @param startIndex 54 * the start index of the range 55 * @param endIndex 56 * the end index of the range (inclusive) 57 * @param model 58 * the task model (required for instantiating the sub sequence) 59 * @param taskFactory 60 * the task factory used for instantiating the sub sequence 61 * @param taskBuilder 62 * the task builder to perform changes in the task structure 63 * 64 * @return a task instance representing the requested sub sequence 65 */ 66 static ITaskInstance getSubSequenceInRange(ITaskInstanceList parent, 67 int startIndex, int endIndex, ISequence model, 68 ITaskFactory taskFactory, ITaskBuilder taskBuilder) { 69 ISequenceInstance subsequence = taskFactory 70 .createNewTaskInstance(model); 69 71 70 return subsequence; 71 } 72 for (int i = startIndex; i <= endIndex; i++) { 73 taskBuilder.addChild(subsequence, parent.get(i)); 74 } 72 75 73 /** 74 * <p> 75 * replaces a sub sequence for a specified range of elements in the provided task instances 76 * list by a sub task instance 77 * </p> 78 * 79 * @param parent the list of which the range shall be replaced 80 * @param startIndex the start index of the range 81 * @param endIndex the end index of the range (inclusive) 82 * @param model the task model (required for instantiating the sub sequence) 83 * @param taskFactory the task factory used for instantiating the sub sequence 84 * @param taskBuilder the task builder to perform changes in the task structure 85 * 86 * @return the replacement for the range 87 */ 88 static ISequenceInstance createNewSubSequenceInRange(ITaskInstanceList parent, 89 int startIndex, 90 int endIndex, 91 ISequence model, 92 ITaskFactory taskFactory, 93 ITaskBuilder taskBuilder) 94 { 95 ISequenceInstance subsequence = taskFactory.createNewTaskInstance(model); 96 97 for (Iterator<ITaskInstance> it = subsequence.iterator();it.hasNext();) { 98 ITaskInstance foo = it.next(); 99 System.out.println(foo); 100 } 101 102 System.out.println("Got model: " + model.toString()); 103 104 105 106 System.out.println(parent); 107 //System.out.println(parent.get(startIndex)); 108 for (int i = startIndex; i <= endIndex; i++) { 109 System.out.println("Trying to add "+ parent.get(startIndex) + " to the model"); 110 taskBuilder.addChild(subsequence, parent.get(startIndex)); 111 112 taskBuilder.removeTaskInstance(parent, startIndex); 113 } 76 return subsequence; 77 } 114 78 115 taskBuilder.addTaskInstance(parent, startIndex, subsequence); 79 /** 80 * <p> 81 * replaces a sub sequence for a specified range of elements in the provided 82 * task instances list by a sub task instance 83 * </p> 84 * 85 * @param parent 86 * the list of which the range shall be replaced 87 * @param startIndex 88 * the start index of the range 89 * @param endIndex 90 * the end index of the range (inclusive) 91 * @param model 92 * the task model (required for instantiating the sub sequence) 93 * @param taskFactory 94 * the task factory used for instantiating the sub sequence 95 * @param taskBuilder 96 * the task builder to perform changes in the task structure 97 * 98 * @return the replacement for the range 99 */ 100 static ISequenceInstance createNewSubSequenceInRange( 101 ITaskInstanceList parent, int startIndex, int endIndex, 102 ISequence model, ITaskFactory taskFactory, ITaskBuilder taskBuilder) { 103 ISequenceInstance subsequence = taskFactory 104 .createNewTaskInstance(model); 116 105 117 return subsequence; 118 } 106 int modelindex=0; 107 for (int i = startIndex; i <= endIndex; i++) { 108 System.out.println("Trying to add " + parent.get(startIndex) 109 + " to the model instance"); 110 ITask tempTask = model.getChildren().get(modelindex); 111 if (tempTask.getType() == "optionality") { 112 IOptionalInstance optional = taskFactory.createNewTaskInstance((IOptional) tempTask); 113 } else if (tempTask.getType() == "selection") { 119 114 120 /** 121 * <p> 122 * returns the next available id (uses the id counter) 123 * </p> 124 * 125 * @return the next available id 126 */ 127 static synchronized String getNewId() { 128 return Integer.toString(idCounter++); 129 } 115 } else if (tempTask.getType() == "sequence") { 116 taskBuilder.addChild(subsequence, parent.get(startIndex)); 117 } else if (tempTask.getType() == "iteration") { 130 118 131 /** 132 * <p> 133 * prevent instantiation 134 * </p> 135 */ 136 private RuleUtils() { 137 // prevent instantiation 138 } 119 } else { 120 121 } 122 taskBuilder.removeTaskInstance(parent, startIndex); 123 modelindex++; 124 } 125 126 taskBuilder.addTaskInstance(parent, startIndex, subsequence); 127 128 return subsequence; 129 } 130 131 /** 132 * <p> 133 * returns the next available id (uses the id counter) 134 * </p> 135 * 136 * @return the next available id 137 */ 138 static synchronized String getNewId() { 139 return Integer.toString(idCounter++); 140 } 141 142 /** 143 * <p> 144 * prevent instantiation 145 * </p> 146 */ 147 private RuleUtils() { 148 // prevent instantiation 149 } 139 150 140 151 } -
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1654 r1655 208 208 int start = jt.next(); 209 209 //TODO: Debug Output 210 /* 210 211 System.out.println("Found match "); 211 212 pattern.getFirstSequence().printSequence(); … … 216 217 System.out.println(appData.getNumber2Task().get(tempns.getSequence()[k])); 217 218 } 219 */ 218 220 pattern.addOccurence( 219 221 new MatchOccurence(start, j));
Note: See TracChangeset
for help on using the changeset viewer.