- Timestamp:
- 08/12/14 21:45:18 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java
r1662 r1665 45 45 46 46 //Recursive check if sequence contains pattern at position i 47 private boolean matches(int i, int[] p1, int[] p2 ,int ip1,int ip2 ) {47 private boolean matches(int i, int[] p1, int[] p2 ,int ip1,int ip2,boolean jumped1,boolean jumped2) { 48 48 49 49 if(p1.length==ip1) { … … 56 56 return false; 57 57 } 58 if((p1[ip1]==sequence[i]||p2[ip2]==sequence[i]) && jumped1) { 59 return matches(i+1,p1,p2,ip1+1,ip2+2,false,false); 60 } 61 if((p1[ip1]==sequence[i]||p2[ip2]==sequence[i]) && jumped2) { 62 return matches(i+1,p1,p2,ip1+2,ip2+1,false,false); 63 } 58 64 if(p1[ip1]==sequence[i]||p2[ip2]==sequence[i]) { 59 return matches(i+1,p1,p2,ip1+1,ip2+1 );65 return matches(i+1,p1,p2,ip1+1,ip2+1,false,false); 60 66 } 61 67 if(p1[ip1]==-1) { 62 return matches(i,p1,p2,ip1+1,ip2 );68 return matches(i,p1,p2,ip1+1,ip2,true,false); 63 69 } 64 70 if(p2[ip2]==-1) { 65 return matches(i,p1,p2,ip1,ip2+1 );71 return matches(i,p1,p2,ip1,ip2+1,false,true); 66 72 } 73 67 74 return false; 68 75 } … … 76 83 77 84 while (i < sequence.length ) { 78 if(matches(i,pat1,pat2,0,0 )) {85 if(matches(i,pat1,pat2,0,0,false,false)) { 79 86 result.add(i); 80 87 }
Note: See TracChangeset
for help on using the changeset viewer.