<commit_before>package edu.ics.game.server;

import java.util.HashMap;
import java.util.UUID;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class GameLobby {
	private Class<? extends Game> gameClass;
	private HashMap<String,GameRoom> rooms = new HashMap<>();
	private HashMap<UUID,GamePlayer> players = new HashMap<>();

	public GameLobby(Class<? extends Game> gameClass) {
		this.gameClass = gameClass;
	}

	public Class<? extends Game> getGameClass() {
		return this.gameClass;
	}

	public JsonNode getState() {
		ObjectMapper mapper = new ObjectMapper();

		ObjectNode state = mapper.createObjectNode();

		ArrayNode rooms = state.putArray("rooms");
		for (GameRoom room : this.rooms.values()) {
			rooms.add(room.getState(false));
		}

		ArrayNode players = state.putArray("players");
		for (GamePlayer player : this.players.values()) {
			players.add(player.getState());
		}
		return state;
	}<commit_msg>Add lobby name<commit_after>package edu.ics.game.server;

import java.util.HashMap;
import java.util.UUID;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class GameLobby {
	private Class<? extends Game> gameClass;
	private HashMap<String,GameRoom> rooms = new HashMap<>();
	private HashMap<UUID,GamePlayer> players = new HashMap<>();

	public GameLobby(Class<? extends Game> gameClass) {
		this.gameClass = gameClass;
	}

	public Class<? extends Game> getGameClass() {
		return this.gameClass;
	}

	public JsonNode getState() {
		ObjectMapper mapper = new ObjectMapper();

		ObjectNode state = mapper.createObjectNode();

		state.put("name", this.gameClass.getSimpleName());

		ArrayNode rooms = state.putArray("rooms");
		for (GameRoom room : this.rooms.values()) {
			rooms.add(room.getState(false));
		}

		ArrayNode players = state.putArray("players");
		for (GamePlayer player : this.players.values()) {
			players.add(player.getState());
		}
		return state;
	}
{'fraction_non_alphanumeric': 0.1284362325371789, 'fraction_numerical': 0.0, 'mean_word_length': 5.082191780821918, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '1209127', 'n_tokens_mistral': 752, 'n_tokens_neox': 672, 'n_words': 152}