private DirDiffElement( DTree parent, @Nullable DiffElement source, @Nullable DiffElement target, DType type, String name) { myParent = parent.getParent(); myNode = parent; myType = type; mySource = source; mySourceLength = source == null || source.isContainer() ? -1 : source.getSize(); myTarget = target; myTargetLength = target == null || target.isContainer() ? -1 : target.getSize(); myName = name; if (type == DType.ERROR) { myDefaultOperation = NONE; } else if (isSource()) { myDefaultOperation = COPY_TO; } else if (isTarget()) { myDefaultOperation = COPY_FROM; } else if (type == DType.EQUAL) { myDefaultOperation = EQUAL; } else if (type == DType.CHANGED) { assert source != null; myDefaultOperation = MERGE; } }
public void updateTargetData() { if (myTarget != null && !myTarget.isContainer()) { myTargetLength = myTarget.getSize(); } else { myTargetLength = -1; } }