Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

RestaurantMatt

Matthew Pohlmann edited this page Jan 1, 2014 · 1 revision

####Description A Restaurant in SimCity201, based upon Matthew Pohlmann's Restaurant project.

####Class Signature

public class RestaurantMatt extends Restaurant {}

####Data

RestaurantRotatingStand stand = new RestaurantRotatingStand();

####Constructors

public Restaurant_Matt(int x, int y, int width, int height, int id, StructurePanel p) {
    super(x, y, width, height, id, p);
    
    this.panel.addGui(stand);
    stand.setPresent(true);

    // All work-related roles are created in the constructor
    cashier = new RestaurantCashierRoleMatt(...);
    cook = new RestaurantCookRoleMatt(...);
    host = new RestaurantHostRoleMatt(...);
    waiters = new List<RestaurantWaiterRoleMatt>(2);
}

####Utility

public Role getRole(Intention role) {
    // Returns the host/cook/cashier/or a waiter if requesting a work-related Role
    // Returns a new RestaurantCustomerRoleMatt if a person wants to eat at the Restaurant
    // Code is fairly messy and complicated, so check the actual implementation for details
}
public void updateTime(CityTime time) {
    if (time = morningShiftStart || time = afternoonShiftStart) forceClosed = false;

    if (time.equalsIgnoreDay(this.morningShiftEnd)) {
        isOpen = false;
	if (host.getPerson() != null) {
	    host.msgClosingTime();
	} else {
	    closingTime();
	}
    }
    else if (time.equalsIgnoreDay(this.closingTime)) {
	Do("It's closing time!");
	if (host.getPerson() != null) {
	    host.msgClosingTime();
	} else {
	    closingTime();
	}
    }
    else if (!isOpen && !forceClosed) {
	checkIfRestaurantShouldOpen();
    }
}
public void closingTime() {
    cashier.msgClosingTime();
    cook.msgClosingTime();
    for (RestaurantWaiterRole r : waiters) {
	r.msgClosingTime();
    }
}
public void emptyEntireCookInventory() {
    ((RestaurantCookRoleMatt) cook).emptyInventory();
}
public List<String> getCookInventory() {
    return ((RestaurantCookRoleMatt) cook).getInventory();
}

Wiki Home | Design Home

Clone this wiki locally