public void mergeBookmark(Address originAddress, String type, String category,
			TaskMonitor monitor) throws CancelledException {
		if (originAddress != null) {
			Address resultAddress = originToResultTranslator.getAddress(originAddress);
			BookmarkManager bm1 = resultProgram.getBookmarkManager();
			BookmarkManager bm2 = originProgram.getBookmarkManager();
			if (type.equals(BookmarkType.NOTE)) {
				Bookmark[] books2 = bm2.getBookmarks(originAddress, type);
				if (books2.length == 0) {
					bm1.removeBookmarks(new AddressSet(resultAddress), type, monitor);
				}
				else if (books2.length == 1) {
					bm1.setBookmark(resultAddress, type, books2[0].getCategory(),
						books2[0].getComment());
				}
				else if (books2.length > 1) {
					throw new AssertException("Error in program '" + resultProgram.getName() +
						"'- Shouldn't be multiple notes at a single address. Address=" +
						originAddress.toString());
				}
			}
			else {
				Bookmark book1 = bm1.getBookmark(resultAddress, type, category);
				Bookmark book2 = bm2.getBookmark(originAddress, type, category);
				if (book2 != null) {
					bm1.setBookmark(resultAddress, type, category, book2.getComment());
				}
				else if (book1 != null) {
					bm1.removeBookmark(book1);
				}
			}
		}
	}
<CODE>mergeBookmark</CODE> merges the indicated bookmark from the origin program into the
result program at an address equivalent to the originAddress.
Merging means replace any existing bookmark of the specified type for NOTEs
or of the specified type and category for non-NOTE types.
<p>Note: This method merges a single bookmark without affecting
other bookmarks at the indicated address.
@param originAddress the address in the origin program where the bookmark is to be merged.
@param type indicates the type of bookmark to merge.
@param category indicates the category of the bookmark.
@param monitor a task monitor for providing feedback to the user.
@throws CancelledException if the user cancels the bookmark merge from the monitor dialog.
Ghidra/Features/Base/src/main/java/ghidra/program/util/ProgramMerge.java