<commit_before>package org.eclipse.emf.ecp.emf2web;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecp.emf2web.json.JSONCrudOperator;
import org.eclipse.emf.ecp.emf2web.util.ClassMapping;
import org.eclipse.emf.ecp.emf2web.util.EcoreHelper;

public class WebHandler {

	private String url;
	private Map<EObject, WebInfo> infoMapping;

	public WebHandler(String url) {
		this.url = url;
		infoMapping = new HashMap<EObject, WebInfo>();
	}

	public List<EObject> getWebElements(EClass eClass) throws IOException {
		List<EObject> result = new ArrayList<EObject>();

		JSONCrudOperator operator = new JSONCrudOperator();
		List<Map<String, Object>> jsonElements = operator.readElements(url,
				eClass.getName().toLowerCase());

		for (Map<String, Object> jsonElement : jsonElements) {
			EObject eObject = EcoreUtil.create(eClass);
			EcoreHelper.setAttributes(eObject, jsonElement);

			String id = getId(jsonElement);
			if (id == null) {
				System.out.println("Could not determine id for element");
			}

			WebInfo info = new WebInfo(id, eClass.getName().toLowerCase());
			infoMapping.put(eObject, info);
			result.add(eObject);
		}

		return result;
	}<commit_msg>Adds getNumberOfWebElements for EClass name<commit_after>package org.eclipse.emf.ecp.emf2web;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecp.emf2web.json.JSONCrudOperator;
import org.eclipse.emf.ecp.emf2web.util.ClassMapping;
import org.eclipse.emf.ecp.emf2web.util.EcoreHelper;

public class WebHandler {

	private String url;
	private Map<EObject, WebInfo> infoMapping;

	public WebHandler(String url) {
		this.url = url;
		infoMapping = new HashMap<EObject, WebInfo>();
	}

	public int getNumberOfWebElements(EClass eClass) throws IOException {
		return getNumberOfWebElements(eClass.getName());
	}

	public int getNumberOfWebElements(String nameOfEClass) throws IOException {
		JSONCrudOperator operator = new JSONCrudOperator();
		return operator.readElements(url, nameOfEClass.toLowerCase()).size();
	}

	public List<EObject> getWebElements(EClass eClass) throws IOException {
		List<EObject> result = new ArrayList<EObject>();

		JSONCrudOperator operator = new JSONCrudOperator();
		List<Map<String, Object>> jsonElements = operator.readElements(url,
				eClass.getName().toLowerCase());

		for (Map<String, Object> jsonElement : jsonElements) {
			EObject eObject = EcoreUtil.create(eClass);
			EcoreHelper.setAttributes(eObject, jsonElement);

			String id = getId(jsonElement);
			if (id == null) {
				System.out.println("Could not determine id for element");
			}

			WebInfo info = new WebInfo(id, eClass.getName().toLowerCase());
			infoMapping.put(eObject, info);
			result.add(eObject);
		}

		return result;
	}
{'fraction_non_alphanumeric': 0.11817898347365138, 'fraction_numerical': 0.002494543186778921, 'mean_word_length': 5.110476190476191, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2656825', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1051, 'n_words': 217}