Untitled

 avatar
unknown
plain_text
2 years ago
25 kB
6
Indexable
package com.soccerment.api.ws.opta;
import java.io.IOException;
import java.util.HashMap;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.log4j.Logger;
//import org.w3c.dom.Document;
//import org.w3c.dom.Element;
//import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import com.soccerment.api.ws.io.entity.Player;
import com.soccerment.api.ws.io.entity.SeasonDetails;
import com.soccerment.api.ws.io.entity.Team;

public class ProcessF30DataUtility {

	private static final Logger logger = Logger.getLogger(ProcessF30DataUtility.class.getName());

	public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {

	}

	private static SeasonDetails computeSoccermentMetrics(String myDate, String season,
			HashMap<String, String> mapPlayerIdRealPosition, HashMap<String, String> mapPlayerIdTeamName,
			SeasonDetails mySeasonStatistics) {
		String myP90 = "P90";

		double ass_goals = 1.00;
		double ass_miss_penalties = -0.76;
		double ass_shot_on_target_in_goals = 0.33;
		double ass_shot_off_target_inc_woodwork = 0.13;
		double ass_blocked_shots = 0.06;

		double ass_goal_assists = 0.40; // 0.30
		double ass_second_goal_assists = 0.10;
		double ass_key_passed_attempt_assists = 0.15;

		double ass_Through_balls = 0.08;

		double ass_Total_Touches_In_Opposition_Box = 0.05;

		double ass_Forward_Passes = 0.04;
		double ass_Rightside_Passes = 0.02;
		double ass_Leftside_Passes = 0.02;
		double ass_Backward_Passes = 0.01;

		double ass_Successful_Launches = 0.05;
		double ass_Unsuccessful_Launches = -0.01;
		double ass_Successful_Lay_offs = 0.01;
		double ass_Unsuccessful_lay_offs = -0.04;

		double ass_successful_cross_open_play = 0.25;

		double ass_Throw_Ins_to_Own_Player = 0.03;

		double ass_Total_Losses_Of_Possession = -0.04;
		double ass_Aerial_Duels_won = 0.05;
		double ass_Aerial_Duels_lost = -0.01;

		double ass_Successful_Dribbles = 0.10;
		double ass_Unsuccessful_Dribbles = -0.03;

		double ass_Saves_Made_from_Inside_Box = 0.45;
		double ass_Saves_Made_from_Outside_Box = 0.13;

		double ass_Goals_Conceded_Inside_Box = -0.40;
		double ass_Goals_Conceded_Outside_Box = -1.0;
		double ass_Yellow_Cards = -0.10;
		double ass_Red_Cards_minus_2nd_Yellow = -0.20;
		double ass_Straight_Red_Cards = -0.4;

		double ass_Penalties_Conceded = -0.4;
		double ass_Total_Fouls_Conceded = -0.02;
		double ass_Total_Fouls_Won = 0.02;

		double ass_Tackles_Won = 0.08;
		double ass_Tackles_Lost = -0.02;
		double ass_Blocks = 0.06; // 0.07
		double ass_Total_Clearances = 0.06;
		double ass_Recoveries = 0.02;
		double ass_Interceptions = 0.08;
		double ass_GK_Successful_Distribution = 0.03;
		double ass_GK_Unsuccessful_Distribution = -0.06;

		double ass_clean_sheets = 1.50;
		double ass_saves_from_penalties = 1.0;


		double[][] ass_Weights = { { 0.75, 0.25, 0 }, { 0.65, 0.25, 0.10 }, { 0.35, 0.40, 0.25 }, { 0.30, 0.40, 0.30 },
				{ 0.20, 0.40, 0.40 }, { 0.15, 0.35, 0.50 }, { 0.15, 0.25, 0.60 }, { 0.35, 0.40, 0.25 } };

		int myIposition = 0;



		for (int iTeam = 0; iTeam < mySeasonStatistics.getMyAllTeam().size(); iTeam++) {
			Team myTeam = mySeasonStatistics.getMyAllTeam().get(iTeam);
			// System.out.println(myTeam);

			if (myTeam == null) {
				continue;
			}

			for (int iPlayer = 0; iPlayer < myTeam.getMyAllPlayers().size(); iPlayer++) {
				Player myPlayer = myTeam.getMyAllPlayers().get(iPlayer);
				HashMap<String, Double> mapStatNameStatValue = myPlayer.getMapStatNameStatValue();
				HashMap<String, Double> mapStatcomputed = new HashMap<>();
				HashMap<String, Double> mapStatcomputed_tmp = new HashMap<>();

				double time_played = mapStatNameStatValue.get("Time Played"); // n

				if (time_played < 270) {
					continue;
				}

//				mapStatNameStatValue.remove("Time Played");

				String playerSoccPosition = mapPlayerIdRealPosition.get(myPlayer.getPlayerId());

				if (playerSoccPosition == null) {
					System.err.println("###### The playerId = " + myPlayer.getPlayerId()
							+ " has no position define yet.. Minute played " + time_played);
					continue;
				}

				if (!mapPlayerIdTeamName.get(myPlayer.getPlayerId()).equalsIgnoreCase(myTeam.getTeamId())) {
					System.err.println("The playerID: " + myPlayer.getPlayerId() + " is present in teams : "
							+ mapPlayerIdTeamName.get(myPlayer.getPlayerId()) + "(actual)  and " + myTeam.getTeamId());
//					logger.info(myPlayer);
					continue;
				}


				double myFlabo = 0;

				double myFlaboRecoveries = 1;

				switch (playerSoccPosition) {
				case "GK":
					myFlabo = 1;
					myFlaboRecoveries = 0.3;
					myIposition = 0;
					break;
				case "CB":
					myIposition = 1;
					break;
				case "FB":
					myIposition = 2;
					break;
				case "CM":
					myIposition = 3;
					break;
				case "CAM":
					myIposition = 4;
					break;
				case "WAM":
					myIposition = 5;
					break;
				case "FW":
					myIposition = 6;
					break;
				case "DMC":
					myIposition = 7;
					break;
				default:
					myIposition = -1;
					break;
				}

				if (myIposition == -1) {
					System.err.println(" myIposition was not defined ");
					continue;
				}

				double shots_recalculated = mapStatNameStatValue.get("Shots On Target ( inc goals )")
						+ mapStatNameStatValue.get("Shots Off Target (inc woodwork)")
						+ mapStatNameStatValue.get("Blocked Shots");

				mapStatcomputed.put("shots_recalculated", shots_recalculated);

				mapStatcomputed.put("Total dribbles", mapStatNameStatValue.get("Successful Dribbles")
						+ mapStatNameStatValue.get("Unsuccessful Dribbles"));

				mapStatcomputed.put("Total short passes", mapStatNameStatValue.get("Successful Short Passes")
						+ mapStatNameStatValue.get("Unsuccessful Short Passes"));

				mapStatcomputed.put("Total long passes", mapStatNameStatValue.get("Successful Long Passes")
						+ mapStatNameStatValue.get("Unsuccessful Long Passes"));

				mapStatcomputed.put("Total passes own half", mapStatNameStatValue.get("Successful Passes Own Half")
						+ mapStatNameStatValue.get("Unsuccessful Passes Own Half"));

				mapStatcomputed.put("Total passes opposition half",
						mapStatNameStatValue.get("Successful Passes Opposition Half")
								+ mapStatNameStatValue.get("Unsuccessful Passes Opposition Half"));

				mapStatcomputed.put("Total launches", mapStatNameStatValue.get("Successful Launches")
						+ mapStatNameStatValue.get("Unsuccessful Launches"));

				mapStatcomputed.put("Total layoffs", mapStatNameStatValue.get("Successful Lay-offs")
						+ mapStatNameStatValue.get("Unsuccessful lay-offs"));

				mapStatcomputed.put("Total throw ins", mapStatNameStatValue.get("Throw Ins to Own Player")
						+ mapStatNameStatValue.get("Throw Ins to Opposition Player"));

				mapStatcomputed.put("Total crosses", mapStatNameStatValue.get("Successful Crosses open play")
						+ mapStatNameStatValue.get("Unsuccessful Crosses open play"));

				mapStatcomputed.put("Total corners into box", mapStatNameStatValue.get("Successful Corners into Box")
						+ mapStatNameStatValue.get("Unsuccessful Corners into Box"));

				mapStatcomputed.put("Non-penalty goals",
						mapStatNameStatValue.get("Goals") - mapStatNameStatValue.get("Penalty Goals"));

				mapStatcomputed.put("Non-penalty shots",
						shots_recalculated - mapStatNameStatValue.get("Penalties Taken"));

				mapStatcomputed.put("Open-play shots", shots_recalculated - mapStatNameStatValue.get("Penalties Taken")
						+ mapStatNameStatValue.get("Attempts from Set Pieces"));

				mapStatcomputed.put("Open-play goals", mapStatNameStatValue.get("Goals")
						- mapStatNameStatValue.get("Penalty Goals") - mapStatNameStatValue.get("Set Pieces Goals"));

				mapStatcomputed.put("Goals & Assists",
						mapStatNameStatValue.get("Goals") + mapStatNameStatValue.get("Goal Assists"));

				mapStatcomputed.put("NP Goals & Assists",
						mapStatcomputed.get("Non-penalty goals") + mapStatNameStatValue.get("Goal Assists"));

				mapStatcomputed.put("Open-play goals & Assists",
						mapStatcomputed.get("Open-play goals") + mapStatNameStatValue.get("Goal Assists"));

				mapStatcomputed.put("Tackles & Interceptions",
						mapStatNameStatValue.get("Tackles Won") + mapStatNameStatValue.get("Interceptions"));

				mapStatcomputed.put("Total recoveries", mapStatNameStatValue.get("Recoveries")
						+ mapStatNameStatValue.get("Tackles Won") + mapStatNameStatValue.get("Interceptions"));

				mapStatcomputed.put("Blocks & Clearances",
						mapStatNameStatValue.get("Blocks") + mapStatNameStatValue.get("Total Clearances"));

				mapStatcomputed.put("GK total distribution", mapStatNameStatValue.get("GK Successful Distribution")
						+ mapStatNameStatValue.get("GK Unsuccessful Distribution"));

				if (myIposition == 0) {// only for GK
					mapStatcomputed.put("Shots against",
							mapStatNameStatValue.get("Saves Made") + mapStatNameStatValue.get("Goals Conceded"));
				}

				mapStatcomputed.put("Chances created", mapStatNameStatValue.get("Goal Assists")
						+ mapStatNameStatValue.get("Key Passes (Attempt Assists)"));

				mapStatcomputed.put("Defensive Actions",
						mapStatNameStatValue.get("Tackles Won") + mapStatNameStatValue.get("Interceptions")
								+ mapStatNameStatValue.get("Blocks") + mapStatNameStatValue.get("Total Clearances"));

//				Set<String> myAllKeys = mapStatcomputed.keySet();

				// compute P90 player by player
				for (String myKey : mapStatcomputed.keySet()) {
					mapStatcomputed_tmp.put(myKey + "_" + myP90,
							(time_played == 0.0) ? 0.0 : mapStatcomputed.get(myKey) / time_played * 90);
				}

				for (String myKey : mapStatcomputed_tmp.keySet()) {
					mapStatcomputed.put(myKey, mapStatcomputed_tmp.get(myKey));
				}

				for (String myKey : mapStatNameStatValue.keySet()) {
					mapStatcomputed.put(myKey, mapStatNameStatValue.get(myKey));
					mapStatcomputed.put(myKey + "_" + myP90,
							(time_played == 0.0) ? 0.0 : mapStatNameStatValue.get(myKey) / time_played * 90);
//					// System.out.println(myKey+"_"+myP90 +" --> " +mapStatcomputed.get(myKey+"_"+myP90) );
				}

				mapStatcomputed.remove("Time Played" + "_" + myP90);

				///// -------- compute ratio

				String ratio = "_paulin";

				// HV = AE3/AI3
				mapStatcomputed.put("Shot_accuracy" + ratio, (shots_recalculated == 0.0) ? 0.0
						: mapStatNameStatValue.get("Shots On Target ( inc goals )") / shots_recalculated);

				// HW = R3/AI3
//				mapStatcomputed.put("Goal_accuracy"+ratio,
//						(shots_recalculated == 0.0) ? 0.0 : mapStatNameStatValue.get("Goals") / shots_recalculated);

				// HX = AV3/AQ3
				mapStatcomputed.put("pass_accuracy" + ratio,
						(mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Total Successful Passes ( Excl Crosses & Corners )")
										/ mapStatNameStatValue.get("Total Passes"));

				mapStatcomputed.put("Short pass accuracy" + ratio,
						(mapStatcomputed.get("Total short passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Short Passes")
										/ mapStatcomputed.get("Total short passes"));

				mapStatcomputed.put("Long pass accuracy" + ratio,
						(mapStatcomputed.get("Total long passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Long Passes")
										/ mapStatcomputed.get("Total long passes"));

				mapStatcomputed.put("Launch accuracy" + ratio, (mapStatcomputed.get("Total launches") == 0.0) ? 0.0
						: mapStatNameStatValue.get("Successful Launches") / mapStatcomputed.get("Total launches"));

				mapStatcomputed.put("Pass accuracy in opposition half" + ratio,
						(mapStatcomputed.get("Total passes opposition half") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Passes Opposition Half")
										/ mapStatcomputed.get("Total passes opposition half"));

				mapStatcomputed.put("Pass accuracy in own half" + ratio,
						(mapStatcomputed.get("Total passes own half") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Passes Own Half")
										/ mapStatcomputed.get("Total passes own half"));

				mapStatcomputed.put("Cross accuracy" + ratio,
						(mapStatcomputed.get("Total crosses") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Crosses open play")
										/ mapStatcomputed.get("Total crosses"));

				mapStatcomputed.put("Corner accuracy" + ratio,
						(mapStatcomputed.get("Total corners into box") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Corners into Box")
										/ mapStatcomputed.get("Total corners into box"));

				mapStatcomputed.put("Throw in accuracy" + ratio, (mapStatcomputed.get("Total throw ins") == 0.0) ? 0.0
						: mapStatNameStatValue.get("Throw Ins to Own Player") / mapStatcomputed.get("Total throw ins"));

				mapStatcomputed.put("Duel success ratio" + ratio, (mapStatNameStatValue.get("Duels") == 0.0) ? 0.0
						: mapStatNameStatValue.get("Duels won") / mapStatNameStatValue.get("Duels"));

				mapStatcomputed.put("Ground duel success ratio" + ratio,
						(mapStatNameStatValue.get("Ground Duels") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Ground Duels won")
										/ mapStatNameStatValue.get("Ground Duels"));

				mapStatcomputed.put("Aerial success ratio" + ratio, (mapStatNameStatValue.get("Aerial Duels") == 0.0)
						? 0.0
						: mapStatNameStatValue.get("Aerial Duels won") / mapStatNameStatValue.get("Aerial Duels"));

				mapStatcomputed.put("Dribble success ratio" + ratio, (mapStatcomputed.get("Total dribbles") == 0.0)
						? 0.0
						: mapStatNameStatValue.get("Successful Dribbles") / mapStatcomputed.get("Total dribbles"));

				mapStatcomputed.put("Tackle success ratio" + ratio,
						(mapStatNameStatValue.get("Total Tackles") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Tackles Won") / mapStatNameStatValue.get("Total Tackles"));
				if (myIposition == 0) {
					mapStatcomputed.put("Saves success ratio" + ratio,
							(mapStatcomputed.get("Shots against") == 0.0) ? 0.0
									: mapStatNameStatValue.get("Saves Made") / mapStatcomputed.get("Shots against"));
				}
				mapStatcomputed.put("Caught balls percentage" + ratio, (mapStatNameStatValue.get("Saves Made") == 0.0)
						? 0.0
						: mapStatNameStatValue.get("Saves made - caught") / mapStatNameStatValue.get("Saves Made"));

				mapStatcomputed.put("GK distribution accuracy" + ratio,
						(mapStatcomputed.get("GK total distribution") == 0.0) ? 0.0
								: mapStatNameStatValue.get("GK Successful Distribution")
										/ mapStatcomputed.get("GK total distribution"));

				mapStatcomputed.put("Percentage of throughballs" + ratio,
						(mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Through balls") / mapStatNameStatValue.get("Total Passes"));

				mapStatcomputed.put("Duel success ratio" + ratio, (mapStatNameStatValue.get("Duels") == 0.0) ? 0.0
						: mapStatNameStatValue.get("Duels won") / mapStatNameStatValue.get("Duels"));

				mapStatcomputed.put("Percentage of forward passes" + ratio,
						(mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Forward Passes")
										/ mapStatNameStatValue.get("Total Passes"));

				mapStatcomputed.put("Percentage of backward passes" + ratio,
						(mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Backward Passes")
										/ mapStatNameStatValue.get("Total Passes"));

				mapStatcomputed.put("Percentage of rightside passes" + ratio,
						(mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Rightside Passes")
										/ mapStatNameStatValue.get("Total Passes"));

				mapStatcomputed.put("Percentage of leftside passes" + ratio,
						(mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Leftside Passes")
										/ mapStatNameStatValue.get("Total Passes"));

				mapStatcomputed.put("Goal conversion" + ratio,
						(shots_recalculated == 0.0) ? 0.0 : mapStatNameStatValue.get("Goals") / shots_recalculated);

				mapStatcomputed.put("Non-penalty goal conversion" + ratio,
						(mapStatcomputed.get("Non-penalty shots") == 0.0) ? 0.0
								: mapStatcomputed.get("Non-penalty goals") / mapStatcomputed.get("Non-penalty shots"));

				mapStatcomputed.put("Open-play goal conversion" + ratio,
						(mapStatcomputed.get("Open-play shots") == 0.0) ? 0.0
								: mapStatcomputed.get("Open-play goals") / mapStatcomputed.get("Open-play shots"));

				mapStatcomputed.put("Percentage of attacking actions" + ratio,
						(mapStatNameStatValue.get("Touches") == 0.0) ? 0.0
								: (mapStatcomputed.get("Chances created") + shots_recalculated)
										/ mapStatNameStatValue.get("Touches"));

				mapStatcomputed.put("Percentage of touches in the opposition box" + ratio,
						(mapStatNameStatValue.get("Touches") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Total Touches In Opposition Box")
										/ mapStatNameStatValue.get("Touches"));

				mapStatcomputed.put("Penalties success ratio" + ratio,
						(mapStatNameStatValue.get("Penalties Taken") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Penalty Goals")
										/ mapStatNameStatValue.get("Penalties Taken"));

				mapStatcomputed.put("Assist conversion" + ratio, (mapStatcomputed.get("Chances created") == 0.0) ? 0.0
						: mapStatNameStatValue.get("Goal Assists") / mapStatcomputed.get("Chances created"));

				mapStatcomputed.put("Percentage of chances created" + ratio,
						(mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
								: mapStatcomputed.get("Chances created") / mapStatNameStatValue.get("Total Passes"));

//				mapStatcomputed.put("Percentage of key passes"+ratio, (mapStatNameStatValue.get("Total Passes") == 0.0) ? 0.0
//						: mapStatNameStatValue.get("Key Passes (Attempt Assists)") / mapStatNameStatValue.get("Total Passes"));

				mapStatcomputed.put("Percentage of success passes in the opposition half" + ratio,
						(mapStatNameStatValue.get("Total Successful Passes ( Excl Crosses & Corners )") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Passes Opposition Half") / mapStatNameStatValue
										.get("Total Successful Passes ( Excl Crosses & Corners )"));

				// HY = BF3/AV3
				mapStatcomputed.put("% successful passes in the opposition half",
						(mapStatNameStatValue.get("Total Successful Passes ( Excl Crosses & Corners )") == 0.0) ? 0.0
								: mapStatNameStatValue.get("Successful Passes Opposition Half") / mapStatNameStatValue
										.get("Total Successful Passes ( Excl Crosses & Corners )"));

				// new entry

//				- Close_range_saves_ratio = saves from inside box / shots against from inside box*
//						- Long_range_saves_ratio = saves from outside box / shots against from outside box**
//
//						Dove:
//						* shots against from inside box = [Goal conceded from inside box + Saves made from inside box]
//						** shots against from outside box = [Goal conceded from outside box + Saves made from outside box]

				double shots_against_from_inside_box = mapStatcomputed.get("Goals Conceded Inside Box")
						+ mapStatcomputed.get("Saves Made from Inside Box");

				double shots_against_from_outside_box = mapStatcomputed.get("Goals Conceded Outside Box")
						+ mapStatcomputed.get("Saves Made from Outside Box");

				mapStatcomputed.put("Close range saves ratio" + ratio, (shots_against_from_inside_box == 0.0) ? 0.0
						: mapStatcomputed.get("Saves Made from Inside Box") / shots_against_from_inside_box);

				mapStatcomputed.put("Long_range_saves_ratio" + ratio, (shots_against_from_outside_box == 0.0) ? 0.0
						: mapStatcomputed.get("Saves Made from Outside Box") / shots_against_from_outside_box);

//				-------------------------

				if (myPlayer.getPlayerId().equals("14937")) {
					// System.out.println(myPlayer);
				}

				// AD = AC3-T3
				mapStatcomputed.put("Missed penalties",
						mapStatNameStatValue.get("Penalties Taken") - mapStatNameStatValue.get("Penalty Goals"));

				// IM
				mapStatcomputed.put("ATTACK", mapStatNameStatValue.get("Goals") * ass_goals
						+ mapStatcomputed.get("Missed penalties") * ass_miss_penalties
						+ mapStatNameStatValue.get("Shots On Target ( inc goals )") * ass_shot_on_target_in_goals
						+ mapStatNameStatValue.get("Shots Off Target (inc woodwork)") * ass_shot_off_target_inc_woodwork
						+ mapStatNameStatValue.get("Blocked Shots") * ass_blocked_shots
						+ mapStatNameStatValue.get("Goal Assists") * ass_goal_assists
						+ mapStatNameStatValue.get("Second Goal Assists") * ass_second_goal_assists
						+ mapStatNameStatValue.get("Key Passes (Attempt Assists)") * ass_key_passed_attempt_assists
						+ mapStatNameStatValue.get("Total Touches In Opposition Box")
								* ass_Total_Touches_In_Opposition_Box);

				// JB
				mapStatcomputed.put("BUILD_UP",
						((mapStatNameStatValue.get("Forward Passes") * ass_Forward_Passes
								+ mapStatNameStatValue.get("Rightside Passes") * ass_Rightside_Passes
								+ mapStatNameStatValue.get("Leftside Passes") * ass_Leftside_Passes
								+ mapStatNameStatValue.get("Backward Passes") * ass_Backward_Passes)
								* mapStatcomputed.get("pass_accuracy" + ratio)
								* (1 + mapStatcomputed.get("% successful passes in the opposition half")))
								+ mapStatNameStatValue.get("Successful Launches") * ass_Successful_Launches
								+ mapStatNameStatValue.get("Unsuccessful Launches") * ass_Unsuccessful_Launches
								+ mapStatNameStatValue.get("Successful Lay-offs") * ass_Successful_Lay_offs
								+ mapStatNameStatValue.get("Unsuccessful lay-offs") * ass_Unsuccessful_lay_offs
								+ mapStatNameStatValue.get("Total Losses Of Possession")
										* ass_Total_Losses_Of_Possession
								+ mapStatNameStatValue.get("Aerial Duels won") * ass_Aerial_Duels_won
								+ mapStatNameStatValue.get("Aerial Duels lost") * ass_Aerial_Duels_lost
								+ mapStatNameStatValue.get("Successful Dribbles") * ass_Successful_Dribbles
								+ mapStatNameStatValue.get("Unsuccessful Dribbles") * ass_Unsuccessful_Dribbles
								+ mapStatNameStatValue.get("Successful Crosses open play")
										* ass_successful_cross_open_play
								+ mapStatNameStatValue.get("Throw Ins to Own Player") * ass_Throw_Ins_to_Own_Player
								+ mapStatNameStatValue.get("Through balls") * ass_Through_balls
								+ mapStatNameStatValue.get("GK Successful Distribution")
										* ass_GK_Successful_Distribution
								+ mapStatNameStatValue.get("GK Unsuccessful Distribution")
										* ass_GK_Unsuccessful_Distribution);

				// JW
				mapStatcomputed.put("DEFENCE",
						mapStatNameStatValue.get("Saves Made from Inside Box") * ass_Saves_Made_from_Inside_Box
								+ mapStatNameStatValue.get("Saves Made from Outside Box")
										* ass_Saves_Made_from_Outside_Box
								+ mapStatNameStatValue.get("Goals Conceded Inside Box") * ass_Goals_Conceded_Inside_Box
										* myFlabo
								+ mapStatNameStatValue.get("Goals Conceded Outside Box")
										* ass_Goals_Conceded_Outside_Box * myFlabo
								+ mapStatNameStatValue.get("Yellow Cards") * ass_Yellow_Cards
								+ mapStatNameStatValue.get("Red Cards - 2nd Yellow") * ass_Red_Cards_minus_2nd_Yellow
								+ mapStatNameStatValue.get("Straight Red Cards") * ass_Straight_Red_Cards
								+ mapStatNameStatValue.get("Penalties Conceded") * ass_Penalties_Conceded
								+ mapStatNameStatValue.get("Total Fouls Conceded") * ass_Total_Fouls_Conceded
								+ mapStatNameStatValue.get("Total Fouls Won") * ass_Total_Fouls_Won
								+ mapStatNameStatValue.get("Tackles Won") * ass_Tackles_Won
								+ mapStatNameStatValue.get("Tackles Lost") * ass_Tackles_Lost
								+ mapStatNameStatValue.get("Blocks") * ass_Blocks
								+ mapStatNameStatValue.get("Total Clearances") * ass_Total_Clearances
								+ mapStatNameStatValue.get("Recoveries") * ass_Recoveries * myFlaboRecoveries
								+ mapStatNameStatValue.get("Interceptions") * ass_Interceptions
								+ mapStatNameStatValue.get("Clean Sheets") * ass_clean_sheets * myFlabo
								+ mapStatNameStatValue.get("Saves from Penalty") * ass_saves_from_penalties);

				// KA=IM3/$N3
				mapStatcomputed.put("ATTACK_P90",
						(time_played == 0.0) ? 0.0 : mapStatcomputed.get("ATTACK") * 90 / time_played);
				// JZ=JB3/$N3
				mapStatcomputed.put("BUILD_UP_P90",
						(time_played == 0.0) ? 0.0 : mapStatcomputed.get("BUILD_UP") * 90 / time_played);
				// JY=JW3/$N3
				mapStatcomputed.put("DEFENCE_P90",
						(time_played == 0.0) ? 0.0 : mapStatcomputed.get("DEFENCE") * 90 / time_played);

				if (myIposition == -1) {
					mapStatcomputed.put("SPR_base", 0.0);
				} else {
					mapStatcomputed.put("SPR_base",
							(mapStatcomputed.get("ATTACK_P90") * ass_Weights[myIposition][2]
									+ mapStatcomputed.get("BUILD_UP_P90") * ass_Weights[myIposition][1]
									+ mapStatcomputed.get("DEFENCE_P90") * ass_Weights[myIposition][0]) * 33);
				}

				myDate = myDate.replace("_", "-");

				mapStatcomputed.remove("% successful passes in the opposition half");

				myPlayer.setMapStatcomputed(mapStatcomputed, myDate, myTeam.getCompId(), season);
				myPlayer.setMapStat(mapStatNameStatValue, myDate, myTeam.getCompId(), season);

				mapStatNameStatValue.putAll(mapStatcomputed);

			}

		}

		return mySeasonStatistics;
	}


}
Editor is loading...