private void createEquate(Program program, CodeUnit codeUnit, int opIndex, Scalar scalar) {

		EquateTable equateTable = codeUnit.getProgram().getEquateTable();
		Address address = codeUnit.getAddress();
		Equate curEquate = equateTable.getEquate(address, opIndex, targetScalarValue);

		if (equateName == null && enoom != null) {
			this.equateName = generateFormattedEquateName();
		}

		if (curEquate == null) {
			SetEquateCmd cmd = new SetEquateCmd(equateName, address, opIndex, targetScalarValue);
			cmd.applyTo(program);
		}
		else if (overwriteExisting) {
			RenameEquateCmd cmd =
				new RenameEquateCmd(curEquate.getName(), equateName, address, opIndex);
			cmd.applyTo(program);
		}
	}
@param scalar user defined scalar to search for in program
@param iter the range of code units for which to maybe create equates
@param enoom the enum to use for formatting the equate name
@param overwriteExisting true to rename existing equates
@param context the action context
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/CreateEquateCmd.java