<commit_before>package utilities.GSON;
import gameAuthoring.scenes.actorBuildingScenes.TowerUpgradeGroup;
import gameEngine.actors.behaviors.IBehavior;
import gameEngine.levels.BaseLevel;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import utilities.errorPopup.ErrorPopup;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;


public class GSONFileReader {



	GsonBuilder gson;
    private List<TowerUpgradeGroup> towerList;
    private List<BaseLevel> levelList;
    private boolean[][] locations;

    public GSONFileReader(){
    	gson = new GsonBuilder();
    	gson.registerTypeAdapter(IBehavior.class, new IBehaviorClassAdapter());
    }

    public List<TowerUpgradeGroup> readTowersFromGameDirectory(String gameDir){
        try{		
            BufferedReader br = new BufferedReader(new FileReader(gameDir + "towers.json"));	
            towerList = gson.create().fromJson(br, new TypeToken<List<TowerUpgradeGroup>>() {}.getType() );	
        } catch(IOException e){
            new ErrorPopup("File" + gameDir + "towers.json could not be found.");
        }		
        return towerList;		
    }


    public List<BaseLevel> readLevelsFromGameDirectory(String gameDir){
        try{		
            BufferedReader br = new BufferedReader(new FileReader(gameDir + "levels.json"));        
            levelList = gson.create().fromJson(br, new TypeToken<List<BaseLevel>>() {}.getType());  
        } catch(IOException e){
            new ErrorPopup("File" + gameDir + "levels.json could not be found.");
        }		

        return levelList;
    }
    
    public boolean[][] readTowerRegionsFromGameDirectory(String gameDir){
        try{            
            BufferedReader br = new BufferedReader(new FileReader(gameDir + "locations.json"));        
            locations = gson.create().fromJson(br, locations.getClass());  
        } catch(IOException e){
            new ErrorPopup("File" + gameDir + "locations.json could not be found.");
        }               

        return locations;
    }
}<commit_msg>fixed gson tower region reading bug<commit_after>package utilities.GSON;
import gameAuthoring.scenes.actorBuildingScenes.TowerUpgradeGroup;
import gameEngine.actors.behaviors.IBehavior;
import gameEngine.levels.BaseLevel;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import utilities.errorPopup.ErrorPopup;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;


public class GSONFileReader {



	GsonBuilder gson;
    private List<TowerUpgradeGroup> towerList;
    private List<BaseLevel> levelList;
    private boolean[][] locations;

    public GSONFileReader(){
    	gson = new GsonBuilder();
    	gson.registerTypeAdapter(IBehavior.class, new IBehaviorClassAdapter());
    }

    public List<TowerUpgradeGroup> readTowersFromGameDirectory(String gameDir){
        try{		
            BufferedReader br = new BufferedReader(new FileReader(gameDir + "towers.json"));	
            towerList = gson.create().fromJson(br, new TypeToken<List<TowerUpgradeGroup>>() {}.getType() );	
        } catch(IOException e){
            new ErrorPopup("File" + gameDir + "towers.json could not be found.");
        }		
        return towerList;		
    }


    public List<BaseLevel> readLevelsFromGameDirectory(String gameDir){
        try{		
            BufferedReader br = new BufferedReader(new FileReader(gameDir + "levels.json"));        
            levelList = gson.create().fromJson(br, new TypeToken<List<BaseLevel>>() {}.getType());  
        } catch(IOException e){
            new ErrorPopup("File" + gameDir + "levels.json could not be found.");
        }		

        return levelList;
    }
    
    public boolean[][] readTowerRegionsFromGameDirectory(String gameDir){
        try{            
            BufferedReader br = new BufferedReader(new FileReader(gameDir + "locations.json"));        
            locations = gson.create().fromJson(br, new boolean[0][0].getClass());  
        } catch(IOException e){
            new ErrorPopup("File" + gameDir + "locations.json could not be found.");
        }               

        return locations;
    }
}
{'fraction_non_alphanumeric': 0.10704225352112676, 'fraction_numerical': 0.00046948356807511736, 'mean_word_length': 2.963720930232558, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '6330393', 'n_tokens_mistral': 1246, 'n_tokens_neox': 1206, 'n_words': 258}