<commit_before>package boundary;

import java.awt.Color;

import desktop_codebehind.Car;
import desktop_codebehind.Car.Builder;
import desktop_fields.Brewery;
import desktop_fields.Chance;
import desktop_fields.Field;
import desktop_fields.Jail;
import desktop_fields.Refuge;
import desktop_fields.Shipping;
import desktop_fields.Start;
import desktop_fields.Street;
import desktop_fields.Tax;
import desktop_resources.GUI;
import entity.DiceCup;
import entity.GameBoard;
import entity.Player;
import entity.PlayerList;
import entity.fields.Ownable;
import entity.language.LanguageHandler;

public class GUIBoundary {

	private static GUIBoundary instance;

	/**
	 * Returns and initializes the instance of the GUIBoundary if it is not already initialized
	 * @return instance - 
	 */
	public static GUIBoundary getInstance() {
		if(instance == null) {
			instance = new GUIBoundary();
		}
		return instance;
	}

	/**
	 * Creates the graphical game board. Initializes every field graphically, which is presented in the GUI
	 * @param gameBoard
	 */
	public void createGameBoard(GameBoard gameBoard) {
		Field[] fields = new Field[gameBoard.getFields().length];
		LanguageHandler language = LanguageHandler.getInstance();

		for(int i = 0; i < gameBoard.getFields().length; i++){

			if(gameBoard.getField(i).getID() == 0) { // Startfelt
				fields[i] = new Start.Builder()
						.setSubText(language.fieldDescription(i))		
						.build();
			} else if(gameBoard.getField(i).getID() == 10 || gameBoard.getField(i).getID() == 30) {
				fields[i] = new Jail.Builder()
						.setSubText(language.fieldNames(i))
						.setDescription(language.fieldDescription(i))
						.build();
			} else if(gameBoard.getField(i) instanceof entity.fields.Brewery){
				fields[i] = new Brewery.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldPrices(gameBoard.getField(i).getPrice()))
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Chance){
				fields[i] = new Chance.Builder()
						.setFgColor(Color.WHITE)
						.setBgColor(Color.BLACK)
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Plot){
				fields[i] = new Street.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldPrices(gameBoard.getField(i).getPrice()))
						.setBgColor(getPropertyGroupColor(gameBoard.getField(i).getPropertyGroup()))
						.setDescription(
								" - Kun grund: " + gameBoard.getField(i).getRentArray()[0] + " | " +
										"1 hus: " + gameBoard.getField(i).getRentArray()[1] + " | " +
										"2 huse: " + gameBoard.getField(i).getRentArray()[2] + " | " +
										"3 huse: " + gameBoard.getField(i).getRentArray()[3] + " | " +
										"4 huse: " + gameBoard.getField(i).getRentArray()[4] + " | " +
										"Hotel: " + gameBoard.getField(i).getRentArray()[5])
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Refuge){
				fields[i] = new Refuge.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldDescription(i))
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.ShippingLine){
				fields[i] = new Shipping.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldPrices(gameBoard.getField(i).getPrice()))
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Tax){
				fields[i] = new Tax.Builder()
						.setTitle(language.fieldNames(i))
						.setDescription(language.fieldDescription(i))
						.build();
			}
		}
		GUI.create(fields);
		GUI.setDice(1, 0, 4, 3, 1, 0, 5, 3);
	}

	/**
	 * Returns the background color of the property group<commit_msg>replaced message in GUI with language method<commit_after> package boundary;

import java.awt.Color;

import desktop_codebehind.Car;
import desktop_codebehind.Car.Builder;
import desktop_fields.Brewery;
import desktop_fields.Chance;
import desktop_fields.Field;
import desktop_fields.Jail;
import desktop_fields.Refuge;
import desktop_fields.Shipping;
import desktop_fields.Start;
import desktop_fields.Street;
import desktop_fields.Tax;
import desktop_resources.GUI;
import entity.DiceCup;
import entity.GameBoard;
import entity.Player;
import entity.PlayerList;
import entity.fields.Ownable;
import entity.language.LanguageHandler;

public class GUIBoundary {

	private static GUIBoundary instance;

	/**
	 * Returns and initializes the instance of the GUIBoundary if it is not already initialized
	 * @return instance - 
	 */
	public static GUIBoundary getInstance() {
		if(instance == null) {
			instance = new GUIBoundary();
		}
		return instance;
	}

	/**
	 * Creates the graphical game board. Initializes every field graphically, which is presented in the GUI
	 * @param gameBoard
	 */
	public void createGameBoard(GameBoard gameBoard) {
		Field[] fields = new Field[gameBoard.getFields().length];
		LanguageHandler language = LanguageHandler.getInstance();

		for(int i = 0; i < gameBoard.getFields().length; i++){

			if(gameBoard.getField(i).getID() == 0) { // Startfelt
				fields[i] = new Start.Builder()
						.setSubText(language.fieldDescription(i))		
						.build();
			} else if(gameBoard.getField(i).getID() == 10 || gameBoard.getField(i).getID() == 30) {
				fields[i] = new Jail.Builder()
						.setSubText(language.fieldNames(i))
						.setDescription(language.fieldDescription(i))
						.build();
			} else if(gameBoard.getField(i) instanceof entity.fields.Brewery){
				fields[i] = new Brewery.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldPrices(gameBoard.getField(i).getPrice()))
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Chance){
				fields[i] = new Chance.Builder()
						.setFgColor(Color.WHITE)
						.setBgColor(Color.BLACK)
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Plot){
				fields[i] = new Street.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldPrices(gameBoard.getField(i).getPrice()))
						.setBgColor(getPropertyGroupColor(gameBoard.getField(i).getPropertyGroup()))
						.setDescription(language.fieldInfo(gameBoard.getField(i).getRentArray(), gameBoard.getField(i).getPrice(), gameBoard.getField(i).getConstructionPrice()))
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Refuge){
				fields[i] = new Refuge.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldDescription(i))
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.ShippingLine){
				fields[i] = new Shipping.Builder()
						.setTitle(language.fieldNames(i))
						.setSubText(language.fieldPrices(gameBoard.getField(i).getPrice()))
						.build();
			}else if(gameBoard.getField(i) instanceof entity.fields.Tax){
				fields[i] = new Tax.Builder()
						.setTitle(language.fieldNames(i))
						.setDescription(language.fieldDescription(i))
						.build();
			}
		}
		GUI.create(fields);
		GUI.setDice(1, 0, 4, 3, 1, 0, 5, 3);
	}

	/**
	 * Returns the background color of the property group
{'fraction_non_alphanumeric': 0.13633794857304324, 'fraction_numerical': 0.005368748233964397, 'mean_word_length': 4.034850640113798, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2949414', 'n_tokens_mistral': 2713, 'n_tokens_neox': 2216, 'n_words': 437}