public Reference replaceReference(Reference resultRef, Reference originRef) {
		ReferenceManager rm = resultProgram.getReferenceManager();
		if (resultRef != null) {
			rm.delete(resultRef); // remove old reference
		}
		if (originRef != null) {
			if (originRef.isExternalReference()) {
				updateExternalLocation(resultProgram, (ExternalReference) originRef);
			}
			return addReference(originRef, -1, true);
		}
		return null;
	}
Replaces the reference in program1 with the reference from the origin program.
@param resultRef the program1 reference to be replaced.
@param originRef the program2 reference used to replace what's in program1.
@return the resulting reference in program1. null if reference is removed
by the replace.
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramMerge.java