JAL-1705 generalised getLength() to handle [start1, end1, start2,