<commit_before>package desperatehousepi;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;

import javax.swing.Timer;

// Generic Person Class

public class Person {
	
	//Set constants
	private static final int millSecsInDay = 1000*60*60*24;
	private static final int millSecsInHour = 1000*60*60;
	private static final int hungerDecreaseRate = 1000*4; //loses 1 hunger every 4 minutes
	private static final int energyDecreaseRate = 1000*15; //loses 1 energy every 15 minutes
	private static final int entertainmentDecreateRate = 1000*10; //loses 1 entertainment every 10 minutes
	
	//Initialize variables
	String first_name = "John";
	String middle_name = "Jacob";
	String last_name = "Smith";
	int age = 0;
	
	private LinkedList<Need> Needs = new LinkedList<Need>(); //the person's set of needs
	
	/**********************************
	 * A generic person class containing general traits to be inherited
	 * @author Anthony and Michael
	 * Edited 10/17/13 by Luke
	 *********************************/
	public Person(){
		//starts the age timer
		new Timer(millSecsInDay, ageMe).start();
		//creates the persons
		Needs.add(new Need("Hunger", hungerDecreaseRate));
		Needs.add(new Need("Energy", energyDecreaseRate));
		Needs.add(new Need("Entertainment", entertainmentDecreateRate));
	}
	
	//Create a timer for the aging process
	private ActionListener ageMe = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent evt) {
			age+=1;
      	}
	};
	
	////////////////////////Access Functions\\\\\\\\\\\\\\\\\\\\\\\\\\\
	
	//Returns the age of the person
	int getAge(){ 
		return age; 
	}
	
	/* Increases the hunger level of the person
	 * Input: the name of the need to be checked.
	 * Output: the new value for the need. If the need is not found in needs.
	 */ 
	int getNeed(String need_name){ 
		
		//Finds the need in the list of needs, then increments it.
		for(Need n : Needs) {
			if (n.getNeedName().equalsIgnoreCase(need_name)) {
				return n.getNeedLevel();
			}; 
		}
		
		//If need is not defined.
		System.out.println("Fatal error. Need " + need_name + " not defined.");
		System.exit(0);
		return 0;
		
	}
	
	///////////////////////Manipulation Functions\\\\\\\\\\\\\\\\\\\\\\\
	
	/* Increases the hunger level of the person
	 * Input: the number that hunger will be incremented by
	 */
	void incrementNeed(String need_name, int amount) {
		for(Need n : Needs)
			if (n.getNeedName().equalsIgnoreCase(need_name)) {
				n.incrementNeed(amount);
			}
		
		//If need is not defined.
		System.out.println("Fatal error. Need '" + need_name + "' not defined.");
		System.exit(0);
		
	}
	
}<commit_msg>Revert "Created Need class. Gave each person a set of needs. Made functions for setting needs more generic."<commit_after>package desperatehousepi;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Timer;

// Generic Person Class

public class Person {
	
	
	
	//Set constants
	private static final int millSecsInDay = 1000*60*60*24;
	//private static final int millSecsInHour = 1000*60*60;
	private static final int hungerMeter = 1000*4; //loses 1 hunger every 4 minutes
	private static final int energyMeter = 1000*15; //loses 1 energy every 15 minutes
	private static final int entertainmentMeter = 1000*10; //loses 1 entertainment every 10 minutes
	
	//Initialize variables
	String first_name = "John";
	String middle_name = "Jacob";
	String last_name = "Smith";

	int age = 0;
	int hunger = 50; //Hunger meter; 0 = starving; 100 = full; default value = 50
	int energy = 50; //Energy meter; 0 = tired; 100 = wide awake; default value = 50
	int entertainment = 50; //Energy meter; 0 = bored; 100 = entertained; default value = 50
	
	/**********************************
	 * A generic person class containing general traits to be inherited
	 * @author Anthony and Michael
	 *********************************/
	public Person(){
		new Timer(millSecsInDay, ageMe).start();
		new Timer(hungerMeter, hungerMe).start();
		new Timer(energyMeter, energyMe).start();
		new Timer(entertainmentMeter, entertainmentMe).start();
	}
	
	//Create a timer for the aging process
	private ActionListener ageMe = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent evt) {
			age+=1;
      	}
	};
	
	//Create a timer for the hunger meter
	private ActionListener hungerMe = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent evt) {
			if(hunger>0) hunger-=1;
      	}
	};
		
	//Create a timer for the energy meter
	private ActionListener energyMe = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent evt) {
			if(hunger>0) energy-=1;
      	}
	};
	
	//Create a timer for the entertainment meter
	private ActionListener entertainmentMe = new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent evt) {
			if(entertainment>0) entertainment-=1;
      	}
	};
	
	////////////////////////Access Functions\\\\\\\\\\\\\\\\\\\\\\\\\\\
	
	//Returns the age of the person
	int getAge(){ return age; }
	
	//Returns the hunger level of the person
	int getHunger(){ return hunger; }
	
	//Returns the energy level of the person
	int getEnergy() { return energy; }
	
	//Returns the entertainment level of the person
	int getEntertainment() { return entertainment; }
	
	///////////////////////Manipulation Functions\\\\\\\\\\\\\\\\\\\\\\\
	
	/* Increases the hunger level of the person
	 * Input: the number that hunger will be incremented by
	 */
	void incrementHunger(int amount) {
		if (hunger + amount > 100) 
			hunger = 100;
		else 
			hunger += amount;
	}
	
	/* Increases the energy level of the person
	 * Input: the number that energy will be incremented by
	 */
	void incrementEnergy(int amount) {
		if (energy + amount > 100) 
			energy = 100;
		else 
			energy += amount;
	}
	
	/* Increases the entertainment level of the person
	 * Input: the number that entertainment will be incremented by
	 */
	void incrementEntertainment(int amount) {
		if (entertainment + amount > 100) 
			entertainment = 100;
		else 
			entertainment += amount;
	}
	
}
{'fraction_non_alphanumeric': 0.14315960912052117, 'fraction_numerical': 0.023941368078175897, 'mean_word_length': 3.1918088737201367, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1881452', 'n_tokens_mistral': 2040, 'n_tokens_neox': 1725, 'n_words': 632}