| 219 | } |
| 220 | |
| 221 | private static void buildChunk(int originLineNumber, int headLineNumber, |
| 222 | int otherLineNumber, int origin, int head, int other, |
| 223 | List<LineObject> originalLines, List<LineObject> headLines, |
| 224 | List<LineObject> otherLines, List<LineObject> result) { |
| 225 | final List<LineObject> originChunk = originalLines.subList(originLineNumber, origin); |
| 226 | final List<LineObject> headChunk = headLines.subList(headLineNumber, head); |
| 227 | final List<LineObject> otherChunk = otherLines.subList(otherLineNumber, other); |
| 228 | |
| 229 | if (headChunk.equals(otherChunk)) { |
| 230 | result.addAll(originChunk); |
| 231 | } else if (originChunk.equals(headChunk)) { |
| 232 | result.addAll(otherChunk); |
| 233 | } else if (originChunk.equals(otherChunk)) { |
| 234 | result.addAll(headChunk); |
| 235 | } else { |
| 236 | result.add(ConstantVal.MERGE_CONFLICT.get(ConstantVal.HEAD_CONFLICT)); |
| 237 | |
| 238 | result.addAll(headChunk); |
| 239 | |
| 240 | result.add(ConstantVal.MERGE_CONFLICT.get(ConstantVal.ORIGIN_CONFLICT)); |
| 241 | |
| 242 | result.addAll(otherChunk); |
| 243 | |
| 244 | result.add(ConstantVal.MERGE_CONFLICT.get(ConstantVal.OTHER_CONFLICT)); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | |
| 249 | private static int nextMisMatch(int indexOrigin, int indexHead, int indexOther, |