Changeset 1664 for branches/autoquest-core-tasktrees-alignment
- Timestamp:
- 08/12/14 21:38:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1662 r1664 203 203 .hasNext();) { 204 204 int start = jt.next(); 205 // TODO: Debug Output206 /*207 * System.out.println("Found match ");208 * pattern.getFirstSequence().printSequence();209 * pattern.getSecondSequence().printSequence();210 * System.out.println("in sequence " + (j+1) +211 * " at position " + start); for(int212 * k=0;k<tempns.getSequence().length;k++) {213 * System.out.print(k + ": " + tempns.getSequence()[k] +214 * " ");215 * System.out.println(appData.getNumber2Task().get(216 * tempns.getSequence()[k])); }217 */218 205 pattern.addOccurence(new MatchOccurence(start, start 219 206 + pattern.size(), j)); … … 255 242 + (oc.getStartindex()) 256 243 + "-" 257 + (oc.getStartindex() + matchseqs.get(i) 258 .getFirstSequence().size())); 244 + oc.getEndindex()); 259 245 System.out.println(); 260 246 … … 265 251 } 266 252 253 // Check if nothing has been replaced in the sequence we 254 // want to replace 255 if (replacedOccurences.get(oc.getSequenceId()) == null) { 256 replacedOccurences.put(oc.getSequenceId(), 257 new LinkedList<MatchOccurence>()); 258 } else { 259 // check if we have any replaced occurence with indexes 260 // smaller than ours. If so, we need to adjust our start 261 // and endpoints 262 // of the replacement. 263 // Also do a check if we have replaced this specific 264 // MatchOccurence in this sequence already. Jump to the 265 // next occurence if this is the case. 266 // This is no more neccessary once the matches are 267 // harmonized. 268 for (Iterator<MatchOccurence> jt = replacedOccurences 269 .get(oc.getSequenceId()).iterator(); jt 270 .hasNext();) { 271 MatchOccurence tmpOC = jt.next(); 272 273 if (oc.getStartindex() >= tmpOC.getStartindex() && oc.getStartindex()<=tmpOC.getEndindex()) { 274 System.out.println("This position has already been replaced in this iteration"); 275 continue invalidOccurence; 276 } 277 if (oc.getEndindex()>=tmpOC.getStartindex()) { 278 continue invalidOccurence; 279 280 } 281 else if (oc.getStartindex()>tmpOC.getEndindex()) { 282 int diff = tmpOC.getEndindex() 283 - tmpOC.getStartindex(); 284 // Just to be sure. 285 if (diff > 0) { 286 System.out.println("Old index: Start: " 287 + oc.getStartindex() + " End " 288 + oc.getEndindex()); 289 oc.setStartindex(oc.getStartindex() - diff+1); 290 oc.setEndindex(oc.getEndindex() - diff+1); 291 System.out.println("Updated index: Start: " 292 + oc.getStartindex() + " End " 293 + oc.getEndindex()); 294 } else { 295 Console.traceln(Level.WARNING, 296 "End index of a Match before start. This should never happen"); 297 } 298 } 299 } 300 } 267 301 ISequenceInstance sequenceInstances = RuleUtils 268 302 .createNewSubSequenceInRange( … … 275 309 + sequenceInstances.size() 276 310 - RuleUtils.missedOptionals); 277 278 updateMatchIndexes(matchseqs, oc.getSequenceId(), 279 oc.getStartindex(), oc.getEndindex()); 280 311 replacedOccurences.get(oc.getSequenceId()).add(oc); 281 312 } 282 313 }
Note: See TracChangeset
for help on using the changeset viewer.