|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdbrown.Waiter
public class Waiter
Simluates a simple waiter who can handle a single order at a time, and waits until an order is available before doing anything.
Field Summary | |
---|---|
static int |
DONE
Comment for DONE |
static int |
FREE
Comment for FREE |
private Order |
order
|
private Restaurant |
restaurant
|
static int |
SERVING
Comment for SERVING |
private int |
status
|
private java.lang.Thread |
t
The waiter's execution thread. |
private java.util.ArrayList<IView> |
views
|
Constructor Summary | |
---|---|
Waiter(Restaurant r)
The Waiter constructor. |
Method Summary | |
---|---|
void |
addView(IView newView)
|
Order |
getOrder()
|
int |
getStatus()
|
void |
run()
|
void |
setOrder(Order order)
|
void |
setStatus(int status)
|
private void |
updateViews()
Updates all views attached to the model. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DONE
DONE
public static final int FREE
FREE
public static final int SERVING
SERVING
private Order order
private Restaurant restaurant
private int status
private java.lang.Thread t
private java.util.ArrayList<IView> views
Constructor Detail |
---|
public Waiter(Restaurant r)
Waiter
constructor.
r
- The restaurant the waiter works at.Method Detail |
---|
public void addView(IView newView)
newView
- public Order getOrder()
public int getStatus()
public void run()
run
in interface java.lang.Runnable
public void setOrder(Order order)
order
- The order to set.public void setStatus(int status)
status
- The status to set.private void updateViews()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |