<commit_before>package domain;

import hibernate.HibernateUtil;

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

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = Player.TABLE)
@PrimaryKeyJoinColumn(name="username")
public class Player extends User {
	public static final String TABLE = "PLAYER";
	
	@Column(unique = true)
	private String mail;
	
	public Player (String user, String name, String sName, String pass, String mail) {
		super(user, name, sName, pass);
		this.mail = mail;
		games = new ArrayList<Game>(2);
		Collections.addAll(games, null, null);
		
		HibernateUtil.update(this);
	}
	
	public Player () {}
		
	@OneToMany(mappedBy = "player", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	private List<Game> games;
	
	public Game getOldGame () {
		return games.get(0);
	}
	
	public void setOldGame (Game g) {
		games.add(0, g);
	}
	
	public Game getCurrentGame () {
		return games.get(1);
	}
	
	public void setCurrentGame (Game g) {
		if (games.size() == 0) {
			Collections.addAll(games, null, g);
		} else {
			Game aged = games.get(1);
		    this.setOldGame(aged);
			games.add(g);
		}
	}
}
<commit_msg>Fix bug setting currentGame to domain.Player<commit_after>package domain;

import hibernate.HibernateUtil;

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

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = Player.TABLE)
@PrimaryKeyJoinColumn(name="username")
public class Player extends User {
	public static final String TABLE = "PLAYER";
	
	@Column(unique = true)
	private String mail;
	
	public Player (String user, String name, String sName, String pass, String mail) {
		super(user, name, sName, pass);
		this.mail = mail;
		games = new ArrayList<Game>(2);
		Collections.addAll(games, null, null);
		
		HibernateUtil.update(this);
	}
	
	public Player () {}
		
	@OneToMany(mappedBy = "player", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
	private List<Game> games;
	
	public Game getOldGame () {
		return games.get(0);
	}
	
	public void setOldGame (Game g) {
		games.add(0, g);
	}
	
	public Game getCurrentGame () {
		return games.get(1);
	}
	
	public void setCurrentGame (Game g) {
		if (games.size() == 0) {
			Collections.addAll(games, null, g);
		} 
		else if (games.size() == 1) {
			games.add(g);
		} else {
			Game aged = games.get(1);
		    this.setOldGame(aged);
			games.add(1, g);
		}
	}
}

{'fraction_non_alphanumeric': 0.12403913347309574, 'fraction_numerical': 0.004891684136967156, 'mean_word_length': 4.321561338289963, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7184108', 'n_tokens_mistral': 1033, 'n_tokens_neox': 938, 'n_words': 239}