Ignore:
Timestamp:
08/04/14 17:27:03 (10 years ago)
Author:
rkrimmel
Message:

Fixed bug where containPattern didn't handle gaps correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java

    r1648 r1650  
    4848        } 
    4949 
    50         //Searching occurences of  
     50        //Searching occurrences of  
    5151        public LinkedList<Integer> containsPattern(Match pattern) { 
    5252                LinkedList<Integer> result = new LinkedList<Integer>(); 
     
    5858                                int ipat1 =0; 
    5959                                int ipat2 =0; 
     60                                int optcount1 = 0; 
     61                                int optcount2 = 0; 
    6062                                while(ipat1 < pat1.length && ipat2<pat2.length) { 
    6163                                        if(pat1[ipat1]==-1) { 
    6264                                                ipat1++; 
     65                                                optcount1++; 
    6366                                                continue; 
    6467                                        } 
    6568                                        if(pat2[ipat2]==-1) { 
    6669                                                ipat2++; 
     70                                                optcount2++; 
    6771                                                continue; 
    6872                                        } 
    69                                         if (sequence[i + ipat1] != pat1[ipat1] 
    70                                                         && sequence[i + ipat2] != pat2[ipat2]) { 
     73                                        if (sequence[i + ipat1-optcount1] != pat1[ipat1] 
     74                                                        && sequence[i + ipat2-optcount2] != pat2[ipat2]) { 
    7175                                                i++; 
     76                                                //System.out.println(sequence[i+ipat1] + " != " + pat1[ipat1] + " || " + sequence[i+ipat2] + " != " + pat2[ipat2]); 
    7277                                                continue notmatched; 
    7378                                        } 
Note: See TracChangeset for help on using the changeset viewer.