<commit_before>package com.boldijarpaul.jsontopojo.parser;

import java.util.ArrayList;
import java.util.List;

import com.boldijarpaul.jsontopojo.entities.ClassFile;
import com.boldijarpaul.jsontopojo.entities.ClassObject;
import com.boldijarpaul.jsontopojo.entities.Variable;
import com.boldijarpaul.jsontopojo.helper.StringHelper;

public class ClassObjectConverter {

	/* converts a class object to a pojo string, line by line */
	public static String toPojo(ClassObject classObject) {
		String result = "import java.util.List;\n\n";
		result += "public class " + classObject.getName() + "{\n";

		/* variables declaration */
		for (Variable variable : classObject.getPrimiveVariables()) {
			result += "private " + variable.getType().toString() + " "
					+ variable.getName() + ";\n";
		}
		for (ClassObject obj : classObject.getObjects()) {
			result += "private " + obj.getName() + " "
					+ StringHelper.firstCharLowerCase(obj.getName()) + ";\n";
		}
		/* Lists declaration */
		for (Variable variable : classObject.getPrimiveVariablesArray()) {
			result += "private List<" + variable.getType().toString() + "> "
					+ variable.getName() + ";\n";
		}
		for (ClassObject obj : classObject.getObjectsArray()) {
			result += "private List<" + obj.getName() + "> "
					+ StringHelper.firstCharLowerCase(obj.getName()) + ";\n";
		}

		result += "\n";

		/* getters setters */
		for (Variable variable : classObject.getPrimiveVariables()) {
			result += GettersSettersGenerator.variableGetterAndSetter(variable);
		}
		for (ClassObject obj : classObject.getObjects()) {
			result += GettersSettersGenerator.classObjectGetterAndSetter(obj);
		}
		/* getters setters for lists */
		for (Variable variable : classObject.getPrimiveVariablesArray()) {
			result += GettersSettersGenerator
					.variableArrayGetterAndSetter(variable);
		}
		for (ClassObject obj : classObject.getObjectsArray()) {
			result += GettersSettersGenerator
					.classObjectArrayGetterAndSetter(obj);
		}
		result += "}";

	}

	/*
	 * a class object can have nested class objects, this method will return
	 * them all, recursively
	 */
	public static List<ClassObject> getAllClassObjects(ClassObject classObject,
			List<ClassObject> classObjects) {<commit_msg>added return<commit_after>package com.boldijarpaul.jsontopojo.parser;

import java.util.ArrayList;
import java.util.List;

import com.boldijarpaul.jsontopojo.entities.ClassFile;
import com.boldijarpaul.jsontopojo.entities.ClassObject;
import com.boldijarpaul.jsontopojo.entities.Variable;
import com.boldijarpaul.jsontopojo.helper.StringHelper;

public class ClassObjectConverter {

	/* converts a class object to a pojo string, line by line */
	public static String toPojo(ClassObject classObject) {
		String result = "import java.util.List;\n\n";
		result += "public class " + classObject.getName() + "{\n";

		/* variables declaration */
		for (Variable variable : classObject.getPrimiveVariables()) {
			result += "private " + variable.getType().toString() + " "
					+ variable.getName() + ";\n";
		}
		for (ClassObject obj : classObject.getObjects()) {
			result += "private " + obj.getName() + " "
					+ StringHelper.firstCharLowerCase(obj.getName()) + ";\n";
		}
		/* Lists declaration */
		for (Variable variable : classObject.getPrimiveVariablesArray()) {
			result += "private List<" + variable.getType().toString() + "> "
					+ variable.getName() + ";\n";
		}
		for (ClassObject obj : classObject.getObjectsArray()) {
			result += "private List<" + obj.getName() + "> "
					+ StringHelper.firstCharLowerCase(obj.getName()) + ";\n";
		}

		result += "\n";

		/* getters setters */
		for (Variable variable : classObject.getPrimiveVariables()) {
			result += GettersSettersGenerator.variableGetterAndSetter(variable);
		}
		for (ClassObject obj : classObject.getObjects()) {
			result += GettersSettersGenerator.classObjectGetterAndSetter(obj);
		}
		/* getters setters for lists */
		for (Variable variable : classObject.getPrimiveVariablesArray()) {
			result += GettersSettersGenerator
					.variableArrayGetterAndSetter(variable);
		}
		for (ClassObject obj : classObject.getObjectsArray()) {
			result += GettersSettersGenerator
					.classObjectArrayGetterAndSetter(obj);
		}
		result += "}";
		
		return result;
	}

	/*
	 * a class object can have nested class objects, this method will return
	 * them all, recursively
	 */
	public static List<ClassObject> getAllClassObjects(ClassObject classObject,
			List<ClassObject> classObjects) {
{'fraction_non_alphanumeric': 0.13272565584704313, 'fraction_numerical': 0.0, 'mean_word_length': 4.317966903073286, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2406886', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1348, 'n_words': 285}