<commit_before>package cs201.structures;

import java.awt.Point;
import java.awt.geom.Rectangle2D;

import cs201.agents.PersonAgent;
import cs201.gui.StructurePanel;
import cs201.helper.CityTime;
import cs201.roles.Role;

/**
 * Base class for all Structures in SimCity201. They are actually Rectangles that can be clicked on in the GUI
 * @author <NAME>
 *
 */
public abstract class Structure extends Rectangle2D.Double {
	protected int id;
	protected StructurePanel panel;
	protected Point guiLocation;
	protected Point entranceLocation;
	protected Point deliveryLocation;
	protected Point parkingLocation;
	protected CityTime closingTime;
	
	private static int INSTANCES = 0;
	
	public Structure(int x, int y, int width, int height, int id, StructurePanel p) {
		super(x, y, width, height);
		
		this.id = ++INSTANCES;
		this.panel = p;
		this.guiLocation = null;
		this.entranceLocation = null;
		this.deliveryLocation = null;
		this.parkingLocation = null;
		this.closingTime = null;
	}
	
	/**
	 * Returns this Structure's unique ID
	 * @return
	 */
	public int getId() {
		return id;
	}
	
	public static int getNextInstance()
	{
		return INSTANCES + 1;
	}
	
	/**
	 * Given an Intention enum (from PersonAgent) will return the correct Role for purposes of assign a Role
	 * @param role The Intention from PersonAgent
	 * @return The correct Role based upon the PersonAgent's intent at this Structure
	 */
	public abstract Role getRole(PersonAgent.Intention role);
	
	/**
	 * Updates the time at this Structure. Used to tell people working there that it's time to close up and go home
	 * @param time The new CityTime
	 */
	public abstract void updateTime(CityTime time);
	
	/**
	 * When this Structure is clicked in the GUI, this Structure's panel will be shown in the card layout of the main program
	 */
	public void displayStructure() {
		panel.displayStructurePanel();
	}<commit_msg>Finalizations on Structure. close #23<commit_after>package cs201.structures;

import java.awt.Point;
import java.awt.geom.Rectangle2D;

import cs201.agents.PersonAgent;
import cs201.gui.StructurePanel;
import cs201.helper.CityTime;
import cs201.roles.Role;

/**
 * Base class for all Structures in SimCity201. They are actually Rectangles that can be clicked on in the GUI
 * @author <NAME>
 *
 */
public abstract class Structure extends Rectangle2D.Double {
	protected int id;
	protected StructurePanel panel;
	protected Point guiLocation;
	protected Point entranceLocation;
	protected Point deliveryLocation;
	protected Point parkingLocation;
	protected CityTime closingTime;
	
	private static int INSTANCES = 0;
	
	public Structure(int x, int y, int width, int height, int id, StructurePanel p) {
		super(x, y, width, height);
		
		this.id = ++INSTANCES;
		this.panel = p;
		this.guiLocation = null;
		this.entranceLocation = null;
		this.deliveryLocation = null;
		this.parkingLocation = null;
		this.closingTime = null;
	}
	
	/**
	 * Returns this Structure's unique ID
	 * @return
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * Used to get a unique ID for a Structure
	 * @return int representing the number of Structures in SimCity
	 */
	public static int getNextInstance() {
		return INSTANCES + 1;
	}
	
	/**
	 * Given an Intention enum (from PersonAgent) will return the correct Role for purposes of assign a Role
	 * @param role The Intention from PersonAgent
	 * @return The correct Role based upon the PersonAgent's intent at this Structure
	 */
	public abstract Role getRole(PersonAgent.Intention role);
	
	/**
	 * Updates the time at this Structure. Used to tell people working there that it's time to close up and go home
	 * @param time The new CityTime
	 */
	public abstract void updateTime(CityTime time);
	
	/**
	 * When this Structure is clicked in the GUI, this Structure's panel will be shown in the card layout of the main program
	 */
	public void displayStructure() {
		panel.displayStructurePanel();
	}
{'fraction_non_alphanumeric': 0.07947019867549669, 'fraction_numerical': 0.011716760061130923, 'mean_word_length': 3.9334170854271355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2253094', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1096, 'n_words': 448}