public void execute() { for (DiffFragment fragment : myFragments) { myContext.myFragment = fragment; process(fragment); DiffString text1 = fragment.getText1(); DiffString text2 = fragment.getText2(); myContext.myStarts[0] += StringUtil.length(text1); myContext.myStarts[1] += StringUtil.length(text2); myContext.myLines[0] += countLines(text1); myContext.myLines[1] += countLines(text2); } }
public boolean isEqual(@NotNull DiffFragment fragment) { if (fragment.isOneSide()) return false; Object[] wrappers = getLineWrappers(new DiffString[] {fragment.getText1(), fragment.getText2()}); return Comparing.equal(wrappers[0], wrappers[1]); }
public static boolean isEmpty(DiffFragment fragment) { return getTextLength(fragment.getText1()) == 0 && getTextLength(fragment.getText2()) == 0; }
static ChangeType fromDiffFragment(DiffFragment fragment) { if (fragment.getText1() == null) return INSERT; if (fragment.getText2() == null) return DELETED; return CHANGE; }