| 66 | |
| 67 | |
| 68 | void DegreePattern::intersect (const DegreePattern& degPat) |
| 69 | { |
| 70 | if (degPat.getLength() < getLength()) |
| 71 | { |
| 72 | DegreePattern bufDeg= *this; |
| 73 | *this= degPat; |
| 74 | return (*this).intersect (bufDeg); |
| 75 | } |
| 76 | |
| 77 | int count= 0; |
| 78 | int length= tmin (getLength(), degPat.getLength()); |
| 79 | int* buf= new int [length]; |
| 80 | for (int i= 0; i < length; i++) |
| 81 | { |
| 82 | if (degPat.find ((*this)[i])) |
| 83 | { |
| 84 | buf[i]= (*this)[i]; |
| 85 | count++; |
| 86 | } |
| 87 | else |
| 88 | buf[i]= -1; |
| 89 | } |
| 90 | ASSERT ( count > 0, "count > 0 expected" ); |
| 91 | |
| 92 | init (count); |
| 93 | count= 0; |
| 94 | for (int i= 0; i < length; i++) |
| 95 | { |
| 96 | if (buf[i] != -1) |
| 97 | { |
| 98 | (*this) [count]= buf[i]; |
| 99 | count++; |
| 100 | } |
| 101 | } |
| 102 | delete[] buf; |
| 103 | } |
| 104 | |
| 105 | void DegreePattern::refine () |
| 106 | { |
no test coverage detected