<commit_before>package jsettlers.logic.map.save;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;

import jsettlers.common.map.IMapData;
import jsettlers.common.map.MapLoadException;
import jsettlers.common.resources.ResourceManager;
import jsettlers.graphics.startscreen.IStartScreenConnector.ILoadableGame;
import jsettlers.input.UIState;
import jsettlers.logic.map.newGrid.GameSerializer;
import jsettlers.logic.map.newGrid.MainGrid;
import jsettlers.logic.map.save.MapFileHeader.MapType;

/**
 * This is the main map list.
 * <p>
 * It lists all available maps, and it can be used to add maps to the game.
 * <p>
 * TODO: load maps before they are needed, to increase startup time.
 * 
 * @author michael
 */
public class MapList {
	private static final String MAP_EXTENSION = ".map";
	private final ArrayList<MapLoader> freshMaps = new ArrayList<MapLoader>();
	private final ArrayList<MapLoader> savedMaps = new ArrayList<MapLoader>();
	private final File dir;
	private boolean fileListLoaded = false;

	public MapList(File dir) {
		this.dir = dir;
		if (!dir.exists()) {
			dir.mkdirs();
		}

	}

	private void loadFileList() {
		freshMaps.clear();
		savedMaps.clear();

		File[] files = dir.listFiles();
		if (files == null) {
			throw new IllegalArgumentException(
			        "map directory is not a directory.");
		}

		for (File file : files) {
			if (file.getName().endsWith(MAP_EXTENSION)) {
				addFileToList(file);
			}
		}

		Collections.sort(freshMaps);
		Collections.sort(savedMaps);<commit_msg>Changed mapcreator to use the default swing paths.<commit_after>package jsettlers.logic.map.save;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;

import jsettlers.common.map.IMapData;
import jsettlers.common.map.MapLoadException;
import jsettlers.common.resources.ResourceManager;
import jsettlers.graphics.startscreen.IStartScreenConnector.ILoadableGame;
import jsettlers.input.UIState;
import jsettlers.logic.map.newGrid.GameSerializer;
import jsettlers.logic.map.newGrid.MainGrid;
import jsettlers.logic.map.save.MapFileHeader.MapType;

/**
 * This is the main map list.
 * <p>
 * It lists all available maps, and it can be used to add maps to the game.
 * <p>
 * TODO: load maps before they are needed, to increase startup time.
 * 
 * @author michael
 */
public class MapList {
	private static final String MAP_EXTENSION = ".map";
	private final ArrayList<MapLoader> freshMaps = new ArrayList<MapLoader>();
	private final ArrayList<MapLoader> savedMaps = new ArrayList<MapLoader>();
	private final File dir;
	private boolean fileListLoaded = false;

	public MapList(File dir) {
		this.dir = dir;
		if (!dir.exists()) {
			dir.mkdirs();
		}

	}

	private void loadFileList() {
		freshMaps.clear();
		savedMaps.clear();

		File[] files = dir.listFiles();
		if (files == null) {
			throw new IllegalArgumentException("map directory "
			        + dir.getAbsolutePath() + " is not a directory.");
		}

		for (File file : files) {
			if (file.getName().endsWith(MAP_EXTENSION)) {
				addFileToList(file);
			}
		}

		Collections.sort(freshMaps);
		Collections.sort(savedMaps);
{'fraction_non_alphanumeric': 0.11117287381878821, 'fraction_numerical': 0.0, 'mean_word_length': 4.605919003115265, 'pattern_counts': {'":': 0, '<': 15, '<?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': '3432583', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1108, 'n_words': 288}