| 103 | } |
| 104 | |
| 105 | void DegreePattern::refine () |
| 106 | { |
| 107 | if (getLength() <= 1) |
| 108 | return; |
| 109 | int count= 0; |
| 110 | int* buf= new int [getLength()]; |
| 111 | int d= (*this) [0]; |
| 112 | int pos; |
| 113 | for (int i= 0; i < getLength(); i++) |
| 114 | buf[i]= -1; |
| 115 | for (int i= 1; i < getLength(); i++) |
| 116 | { |
| 117 | pos= (*this).find (d - (*this)[i]); |
| 118 | if (pos) |
| 119 | { |
| 120 | buf[i]= (*this)[i]; |
| 121 | count++; |
| 122 | } |
| 123 | } |
| 124 | buf[0]= d; |
| 125 | count++; |
| 126 | if (count == getLength()) |
| 127 | { |
| 128 | delete [] buf; |
| 129 | return; |
| 130 | } |
| 131 | int length= getLength(); |
| 132 | |
| 133 | ASSERT ( count > 0, "count > 0 expected" ); |
| 134 | init (count); |
| 135 | count= 0; |
| 136 | for (int i= 0; i < length; i++) |
| 137 | { |
| 138 | if (buf[i] != -1) |
| 139 | { |
| 140 | (*this)[count]= buf[i]; |
| 141 | count++; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | delete[] buf; |
| 146 | return; |
| 147 | } |
| 148 |
no test coverage detected