Changeset 1693 for branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/NumberSequence.java
- Timestamp:
- 08/24/14 21:12:44 (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
r1665 r1693 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,boolean jumped1,boolean jumped2) { 47 private boolean matches(int i, 48 int[] p1, 49 int[] p2 , 50 int ip1, 51 int ip2, 52 boolean jumped1, //True if there was a gap in Sequence 1 of the pattern 53 boolean jumped2, //True if there was a gap in Sequence 2 of the pattern 54 boolean hadSelection, //True if the last match was a selection 55 boolean matchseq1, 56 boolean matchseq2) { 48 57 49 58 if(p1.length==ip1) { … … 56 65 return false; 57 66 } 58 if((p1[ip1]==sequence[i]||p2[ip2]==sequence[i]) && jumped1) { 59 return matches(i+1,p1,p2,ip1+1,ip2+2,false,false); 67 68 boolean foundselection=(!(p1[ip1] == p2[ip2])&&!(p1[ip1]==-1||p2[ip2]==-1)); 69 boolean matchInFirstPattern = (p1[ip1]==sequence[i]); 70 boolean matchInSecondPattern = (p2[ip2]==sequence[i]); 71 72 if(foundselection && hadSelection) { 73 if((matchInFirstPattern && matchseq1) || (matchInSecondPattern && matchseq2)){ 74 if(jumped1) { 75 return matches(i+1,p1,p2,ip1+1,ip2+2,false,false,foundselection,matchInFirstPattern,matchInSecondPattern); 76 } 77 if(jumped2) { 78 return matches(i+1,p1,p2,ip1+2,ip2+1,false,false,foundselection,matchInFirstPattern,matchInSecondPattern); 79 } 80 return matches(i+1,p1,p2,ip1+1,ip2+1,false,false,foundselection,matchInFirstPattern,matchInSecondPattern); 81 } 82 else { 83 return false; 84 } 60 85 } 61 if((p1[ip1]==sequence[i]||p2[ip2]==sequence[i]) && jumped2) { 62 return matches(i+1,p1,p2,ip1+2,ip2+1,false,false); 86 87 if((matchInFirstPattern||matchInSecondPattern) && jumped1) { 88 return matches(i+1,p1,p2,ip1+1,ip2+2,false,false,foundselection,matchInFirstPattern,matchInSecondPattern); 63 89 } 64 if(p1[ip1]==sequence[i]||p2[ip2]==sequence[i]) { 65 return matches(i+1,p1,p2,ip1+1,ip2+1,false,false); 90 if((matchInFirstPattern||matchInSecondPattern) && jumped2) { 91 return matches(i+1,p1,p2,ip1+2,ip2+1,false,false,foundselection,matchInFirstPattern,matchInSecondPattern); 92 } 93 if(matchInFirstPattern||matchInSecondPattern) { 94 return matches(i+1,p1,p2,ip1+1,ip2+1,false,false,foundselection,matchInFirstPattern,matchInSecondPattern); 66 95 } 67 96 if(p1[ip1]==-1) { 68 return matches(i,p1,p2,ip1+1,ip2,true,false );97 return matches(i,p1,p2,ip1+1,ip2,true,false,false,false,false); 69 98 } 70 99 if(p2[ip2]==-1) { 71 return matches(i,p1,p2,ip1,ip2+1,false,true );100 return matches(i,p1,p2,ip1,ip2+1,false,true,false,false,false); 72 101 } 73 102 … … 83 112 84 113 while (i < sequence.length ) { 85 if(matches(i,pat1,pat2,0,0,false,false )) {114 if(matches(i,pat1,pat2,0,0,false,false,false,false,false)) { 86 115 result.add(i); 87 116 }
Note: See TracChangeset
for help on using the changeset viewer.