<commit_before>package com.example.crystalgame.ui;

import java.util.ArrayList;

import com.example.crystalgame.datawarehouse.ClientDataWarehouse;
import com.example.crystalgame.library.data.GameBoundary;
import com.example.crystalgame.library.data.GameLocation;
import com.example.crystalgame.library.data.Location;
import com.example.crystalgame.library.data.Zone;
import com.example.crystalgame.library.datawarehouse.DataWarehouseException;

/**
 *  Notify & keep track of zone changes
 *  @author <NAME>, <NAME>
 *
 */
public class ZoneTracker {

	
	private ArrayList<Location> boundaryPoints = null;
	private ArrayList<Location> gameLocationPoints = null;
	
	private static ZoneTracker zoneTracker = null;
	
	private ZoneTracker() 
	{
		// private constructor
	}
	
	/**
	 * Singleton instance
	 * @return ZoneTracker
	 */
	public static ZoneTracker getInstance() {
		if(null == zoneTracker) {
			zoneTracker = new ZoneTracker();
		}
		
		return zoneTracker;
	}
	
	/**
	 * Game Boundary points
	 * @return List of locations
	 */
	public ArrayList<Location> getBoundaryPoints() {
		/*
		boundaryPoints = new ArrayList<Location>();
		boundaryPoints.add(new Location(53.34373266956245, -6.247414081275463));
		boundaryPoints.add(new Location(53.34372426266502 ,-6.247033790433407));
		boundaryPoints.add(new Location(53.34363979327044, -6.247001939201355));
		boundaryPoints.add(new Location(53.34363338800144, -6.2474171864748));
		if(boundaryPoints!=null)
		{
			Log.d("Not null","OK");
		}
		*/
		try {
			GameBoundary gameBoundary = (GameBoundary)ClientDataWarehouse.getInstance().getList(GameBoundary.class);
			boundaryPoints = gameBoundary.getLocationList();
		} catch (DataWarehouseException e) {
			e.printStackTrace();
		}
		
		return boundaryPoints;
	}
	
	public void setBoundaryPoints(GameBoundary gameBoundary) {
		this.boundaryPoints = gameBoundary.getLocationList();
	}
	
	/**
	 * Game Location points
	 * @return List of locations
	 */
	public ArrayList<Location> getGameLocationPoints() {
		/*
		gameLocationPoints = new ArrayList<Location>();
		gameLocationPoints.add(new Location(53.34373266956245, -6.247314081275463));
		gameLocationPoints.add(new Location(53.34372426266502 ,-6.247133790433407));
		gameLocationPoints.add(new Location(53.34363979327044, -6.247101939201355));
		gameLocationPoints.add(new Location(53.34363338800144, -6.2473171864748));
		*/
		try {
			GameLocation gameLocation = (GameLocation)ClientDataWarehouse.getInstance().getList(GameLocation.class);
			gameLocationPoints = gameLocation.getLocationList();
		} catch (DataWarehouseException e) {
			e.printStackTrace();
		}
		
		return gameLocationPoints;
	}
	
	public void setGameLocationPoints(GameBoundary gameBoundary) {
		
		this.gameLocationPoints = gameBoundary.getLocationList();<commit_msg>Fix zone retrieval<commit_after>package com.example.crystalgame.ui;

import java.util.ArrayList;
import java.util.List;

import com.example.crystalgame.datawarehouse.ClientDataWarehouse;
import com.example.crystalgame.library.data.GameBoundary;
import com.example.crystalgame.library.data.GameLocation;
import com.example.crystalgame.library.data.HasID;
import com.example.crystalgame.library.data.Location;
import com.example.crystalgame.library.data.Zone;
import com.example.crystalgame.library.datawarehouse.DataWarehouseException;

/**
 *  Notify & keep track of zone changes
 *  @author <NAME>, <NAME>
 *
 */
public class ZoneTracker {

	
	private ArrayList<Location> boundaryPoints = null;
	private ArrayList<Location> gameLocationPoints = null;
	
	private static ZoneTracker zoneTracker = null;
	
	private ZoneTracker() 
	{
		// private constructor
	}
	
	/**
	 * Singleton instance
	 * @return ZoneTracker
	 */
	public static ZoneTracker getInstance() {
		if(null == zoneTracker) {
			zoneTracker = new ZoneTracker();
		}
		
		return zoneTracker;
	}
	
	/**
	 * Game Boundary points
	 * @return List of locations
	 */
	public ArrayList<Location> getBoundaryPoints() {
		try {
			List<HasID> boundaries = ClientDataWarehouse.getInstance().getList(GameBoundary.class);
			if (boundaries == null || boundaries.size() == 0) {
				return boundaryPoints;
			}
			
			GameBoundary gameBoundary = (GameBoundary) boundaries.get(0);
			boundaryPoints = gameBoundary.getLocationList();
		} catch (DataWarehouseException e) {
			// Ignore
		}
		
		return boundaryPoints;
	}
	
	public void setBoundaryPoints(GameBoundary gameBoundary) {
		this.boundaryPoints = gameBoundary.getLocationList();
	}
	
	/**
	 * Game Location points
	 * @return List of locations
	 */
	public ArrayList<Location> getGameLocationPoints() {
		try {
			List<HasID> locations = ClientDataWarehouse.getInstance().getList(GameLocation.class);
			if (locations == null || locations.size() == 0) {
				return gameLocationPoints;
			}
			
			gameLocationPoints = ((GameLocation) locations.get(0)).getLocationList();
		} catch (DataWarehouseException e) {
			e.printStackTrace();
		}
		
		return gameLocationPoints;
	}
	
	public void setGameLocationPoints(GameBoundary gameBoundary) {
		
		this.gameLocationPoints = gameBoundary.getLocationList();
{'fraction_non_alphanumeric': 0.11091514795218499, 'fraction_numerical': 0.050166568685087204, 'mean_word_length': 4.70917225950783, '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': '4938090', 'n_tokens_mistral': 1876, 'n_tokens_neox': 1533, 'n_words': 289}