Ref<Change> (int length1, int length2, int startShift, int endCut) { int trimmedLength1 = length1 - startShift - endCut; int trimmedLength2 = length2 - startShift - endCut; if (trimmedLength1 != 0 && trimmedLength2 != 0) return null; Change change = trimmedLength1 != 0 || trimmedLength2 != 0 ? new Change(startShift, startShift, trimmedLength1, trimmedLength2, null) : null; return new Ref<>(change); }