(Item other)
| 205 | } |
| 206 | |
| 207 | @Override |
| 208 | public int compareTo(Item other) { |
| 209 | int diff = opcode - other.getOpcode(); |
| 210 | if (diff != 0) { |
| 211 | return diff; |
| 212 | } |
| 213 | // We have two items with the same opcode. Need to investigate their |
| 214 | // structure. |
| 215 | diff = size() - other.size(); |
| 216 | if (diff != 0) { |
| 217 | return diff; |
| 218 | } |
| 219 | for (int i = 0; i != size(); ++i) { |
| 220 | Item my_ith = get(i); |
| 221 | Item other_ith = other.get(i); |
| 222 | if (my_ith == null && other_ith == null) { |
| 223 | // skip |
| 224 | } else if(my_ith == null) { |
| 225 | // null is below everything |
| 226 | return -1; |
| 227 | } else if(other_ith == null) { |
| 228 | return 1; |
| 229 | } else { |
| 230 | diff = my_ith.compareTo(other_ith); |
| 231 | if (diff != 0) { |
| 232 | return diff; |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | return compareData(data, other.getData()); |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * Compare the data object associated with a given syntactic item. An |
no test coverage detected