<commit_before>package generator;

public class MethodGenerator {
	private def owner
	private def name
	private def code = new StringBuilder()

	private def MethodGenerator(owner) {
		this.owner = owner
		this.name = Utils.generateName("met", "", (Utils.rand.nextInt(10) + 4))
	}

	private def addMethodId(methodId) {
		code.append("\t\tint methodId = $methodId;\n")
	}

	private def addLocals() {
		def logic = LocalsGenerator.generateLocals()
		def lines = logic.collect({ "\t\t$it" })

		code.append(lines.join("\n"))
	}

	private def addLogic() {
		def logic = LogicGenerator.generateBlocks([:])
		def lines = logic.print("\t\t")

		code.append(lines.join("\n"))
	}

	private def addBridge(classes) {
		def lines = BridgeGenerator.generate(classes).collect({ "\t\t$it" })

		code.append(lines.join("\n"))
	}

	def addEvent() {
		def lines = EventGenerator.addEvent()
	}

	private def generate() {
		def codeStr = code.toString()

		return """
	public static void $name(Context context) throws Exception
	{
		$codeStr
	}
"""
	}
}<commit_msg>optimize the generation of methods code<commit_after>package generator;

public class MethodGenerator {
	private def owner
	private def name
	private def code = new StringBuilder()

	private def MethodGenerator(owner) {
		this.owner = owner
		this.name = Utils.generateName("met", "", (Utils.rand.nextInt(10) + 4))
	}

	private def addMethodId(methodId) {
		code.append("\t\tint methodId = $methodId;\n")
	}

	private def addLocals() {
		def logic = LocalsGenerator.generateLocals()
		def lines = logic.collect({ "\t\t$it" })

		code.append(lines.join("\n"))
	}

	private def addLogic() {
		def logic = LogicGenerator.generateBlocks([:])
		def lines = logic.print("\t\t")

		code.append(lines.join("\n"))
	}

	private def addBridge(classes) {
		def lines = BridgeGenerator.generate(classes).collect({ "\t\t$it" })

		code.append(lines.join("\n"))
	}

	def addEvent() {
		def lines = EventGenerator.addEvent()
	}

	private def generate() {
		def codeStr = code.toString()

		return new StringBuilder()
			.append("public static void $name(Context context) throws Exception")
			.append("{")
			.append(codeStr)
			.append("}").toString()
	}
}
{'fraction_non_alphanumeric': 0.15286041189931351, 'fraction_numerical': 0.002745995423340961, 'mean_word_length': 4.0368663594470044, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6808806', 'n_tokens_mistral': 777, 'n_tokens_neox': 708, 'n_words': 169}