public Reference replaceReference(Reference resultRef, Reference originRef, long toSymbolID) {
		ReferenceManager rm = resultProgram.getReferenceManager();
		if (resultRef != null) {
			// Removing ref.
			rm.delete(resultRef);
		}
		if (originRef != null) {
			Address toAddress = originToResultTranslator.getAddress(originRef.getToAddress());
			Symbol resultToSymbol = resultProgram.getSymbolTable().getSymbol(toSymbolID);
			if (resultToSymbol != null && !resultToSymbol.getAddress().equals(toAddress)) {
				resultToSymbol = null;
			}
			resultRef = DiffUtility.createReference(originProgram, originRef, resultProgram);
			if (resultToSymbol != null) {
				rm.setAssociation(resultToSymbol, resultRef);
			}
		}
		else {
			resultRef = null;
		}
		return resultRef;
	}
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.
@param toSymbolID ID of the symbol in program1 the resulting reference is to.
@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