<commit_before>package me.vrekt.lunar.world;

import java.awt.Graphics;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;

import me.vrekt.lunar.entity.Entity;
import me.vrekt.lunar.location.Location;
import me.vrekt.lunar.tile.Tile;
import me.vrekt.lunar.world.dir.Direction;

public abstract class World {

	protected HashMap<Location, Tile> worldInfo = new HashMap<Location, Tile>();
	protected List<Entity> worldEntities = new ArrayList<Entity>();
	protected String name;

	protected int width, height;

	public World(String name, int width, int height) {
		this.name = name;

		this.width = width;
		this.height = height;

	}

	public World(File file, ArrayList<Tile> tiles) {

	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Add an entity to the world.
	 */
	public void addEntity(Entity entity) {
		worldEntities.add(entity);
	}

	public void removeEntity(Entity entity) {
		worldEntities.remove(entity);
	}

	/**
	 * Add a tile
	 */
	public void addTile(int x, int y, Tile tile) {
		worldInfo.put(new Location(x, y), tile);
	}

	/**
	 * Add multiple tiles in one direction, easier for making worlds/maps.
	 * 
	 * @param x
	 * @param y
	 * @param direction
	 * @param multiplier
	 *            indicates how many tiles to draw in the direction.
	 */
	public void addBatchTiles(Tile tile, int x, int y, Direction direction, int multiplier) {
		int width = tile.getWidth();
		int height = tile.getHeight();

		while (multiplier > 0) {
			multiplier--;

			switch (direction) {
			case UP:
				worldInfo.put(new Location(x, y), tile);
				y -= height;
				break;
			case DOWN:
				worldInfo.put(new Location(x, y), tile);
				y += height;
				break;
			case LEFT:
				worldInfo.put(new Location(x, y), tile);
				x -= width;
				break;
			case RIGHT:
				worldInfo.put(new Location(x, y), tile);
				x += width;
				break;
			}

		}

	}

	/**
	 * Remove the tile.
	 * 
	 * @param x
	 * @param y<commit_msg>improvements to addBatchTiles<commit_after>package me.vrekt.lunar.world;

import java.awt.Graphics;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;

import me.vrekt.lunar.entity.Entity;
import me.vrekt.lunar.location.Location;
import me.vrekt.lunar.tile.Tile;
import me.vrekt.lunar.world.dir.Direction;

public abstract class World {

	protected HashMap<Location, Tile> worldInfo = new HashMap<Location, Tile>();
	protected List<Entity> worldEntities = new ArrayList<Entity>();
	protected String name;

	protected int width, height;

	public World(String name, int width, int height) {
		this.name = name;

		this.width = width;
		this.height = height;

	}

	public World(File file, ArrayList<Tile> tiles) {

	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Add an entity to the world.
	 */
	public void addEntity(Entity entity) {
		worldEntities.add(entity);
	}

	public void removeEntity(Entity entity) {
		worldEntities.remove(entity);
	}

	/**
	 * Add a tile
	 */
	public void addTile(int x, int y, Tile tile) {
		worldInfo.put(new Location(x, y), tile);
	}

	/**
	 * Add multiple tiles in one direction, easier for making worlds/maps.
	 * 
	 * @param x
	 * @param y
	 * @param direction
	 * @param multiplier
	 *            indicates how many tiles to draw in the direction.
	 */
	public void addBatchTiles(Tile tile, int x, int y, Direction direction, int tileAmount) {
		int width = tile.getWidth();
		int height = tile.getHeight();

		while (tileAmount > 0) {
			tileAmount--;

			worldInfo.put(new Location(x, y), tile);
			x = direction == Direction.RIGHT ? x + width : direction == Direction.LEFT ? x - width : x;
			y = direction == Direction.DOWN ? y + height : direction == Direction.UP ? y - height : y;

		}

	}

	/**
	 * Remove the tile.
	 * 
	 * @param x
	 * @param y
{'fraction_non_alphanumeric': 0.12566776901551768, 'fraction_numerical': 0.0005087763927753752, 'mean_word_length': 3.2143622722400855, 'pattern_counts': {'":': 0, '<': 13, '<?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': '3813485', 'n_tokens_mistral': 1432, 'n_tokens_neox': 1279, 'n_words': 379}