<commit_before>package it.polimi.modaclouds.cloudapp.mic.servlet;

import it.polimi.modaclouds.cloudapp.mic.entity.UserRatings;
import it.polimi.modaclouds.cpimlibrary.mffactory.MF;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class ComputeSimilarity {
	private static final long serialVersionUID = 1L;
	PairsUser reset = new PairsUser("", -2);
	PairsUser[] rank = new PairsUser[3];
	MF mf=MF.getFactory();
	public ComputeSimilarity(String usermail, String editS)
	{	
		System.out.println("compute");
		boolean edit=new Boolean(editS);
		@SuppressWarnings("unchecked")
		List<UserRatings> ratings =mf.getEntityManagerFactory().createCloudEntityManager().createQuery("SELECT ur FROM UserRatings ur WHERE email=:email").setParameter("email", usermail).getResultList();
		String topicName = null;
		for (UserRatings myRatings : ratings) {
			initRanking();
			topicName = myRatings.getTopicName();
			@SuppressWarnings("unchecked")
			List<UserRatings> resultList = (List<UserRatings>) mf
					.getEntityManagerFactory()
					.createCloudEntityManager()
					.createQuery(
							"SELECT ur FROM UserRatings ur WHERE topicName=:topic")
					.setParameter("topic", topicName).getResultList();

			
			float sim = 0;
            ///////////////////////
			ArrayList<Integer> myRatings_int = new ArrayList<Integer>();
			List<String> myRatings_str = myRatings.getRatings();
			for(int i = 0; i < myRatings_str.size(); i++) {
				myRatings_int.add(0);<commit_msg>corretti errori nelle query della classe ComputeSimilarity<commit_after>package it.polimi.modaclouds.cloudapp.mic.servlet;

import it.polimi.modaclouds.cloudapp.mic.entity.UserRatings;
import it.polimi.modaclouds.cpimlibrary.mffactory.MF;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class ComputeSimilarity {
	private static final long serialVersionUID = 1L;
	PairsUser reset = new PairsUser("", -2);
	PairsUser[] rank = new PairsUser[3];
	MF mf=MF.getFactory();
	public ComputeSimilarity(String usermail, String editS)
	{	
		System.out.println("compute");
		boolean edit=new Boolean(editS);
		@SuppressWarnings("unchecked")
		List<UserRatings> ratings =mf.getEntityManagerFactory().createCloudEntityManager().createQuery("SELECT ur FROM UserRatings ur WHERE ur.email=:email").setParameter("email", usermail).getResultList();
		String topicName = null;
		for (UserRatings myRatings : ratings) {
			initRanking();
			topicName = myRatings.getTopicName();
			@SuppressWarnings("unchecked")
			List<UserRatings> resultList = (List<UserRatings>) mf
					.getEntityManagerFactory()
					.createCloudEntityManager()
					.createQuery(
							"SELECT ur FROM UserRatings ur WHERE ur.topicName=:topic")
					.setParameter("topic", topicName).getResultList();

			
			float sim = 0;
            ///////////////////////
			ArrayList<Integer> myRatings_int = new ArrayList<Integer>();
			List<String> myRatings_str = myRatings.getRatings();
			for(int i = 0; i < myRatings_str.size(); i++) {
				myRatings_int.add(0);
{'fraction_non_alphanumeric': 0.13316816351811706, 'fraction_numerical': 0.0037163208423660575, 'mean_word_length': 4.636998254799302, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '6819300', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1007, 'n_words': 209}