|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--haifa.shopsim.UI.ShopViewUpdater
This class is designed to pace information between the simulation engine and the graphics components: animation, table, gant chart, etc..
It allows registration of a shopTraceMaker (that actually passes all of the event objects to the gant chart, and it also allows registration of the ShopChangeListeners (these all get time moved events). This means, that except for the gant chart that gets the info though the shop trace maker, the other components do not actually get the full information, they rather get TimeMovedEvents. That tell them to update from the shop state (which they have refernces to ).
The GUI application controlls this class by using the setRawSpeed() method. The GUI is to set a speed value between 0 and 100. 0 being the slowest and 100 the fastest.
Field Summary | |
protected int |
eventCounter
Counts the number of shopChangeEvents that occured since the last time the listeners and gantt were updated. |
protected double |
lastEventTime
Stores the time of the last event recived from the ShopSimulation. |
protected long |
lastUpdateTimeMillis
Stores the real world time (in millis) since the last time the system was updated. |
protected java.util.ArrayList |
listenerList
List of listeners (anim, table, etc...). |
protected static long |
MANDETORY_SLEEP_TIME
The ShopViewUpdater alwasy sleeps for this time between updates so that the GUI may breath. |
protected static long |
MAX_EVENT_SKIP
The maximal number of appropriate events that are skipped (when rawSpeed=100). |
protected static int |
MAX_SLEEP
The maximal sleep time between GUI updates (when rawSpeed=0) |
protected int |
maxEventCount
When the rawSpeed>50 this counts the number of appropriate events that are to occur before the shop is updated. |
protected static long |
MILLS_LAST_EVENT
Time that shop view updater allows between two events without "forcing" an update of the GUI |
protected int |
rawSpeed
Value of 0,...,100, the rawSpeed value recieved from the GUI |
protected ShopTraceMaker |
shopTraceMaker
A reference to the shopTrace Maker, this object is asked to send a display trace whenever the other listeners are modified. |
protected long |
sleepTime
The time to sleep between appropriate event updates (when raw speed is less than 50). |
protected ThreadFastShopRun |
threadFastShopRun
Refrence to the patient shop run object. |
Constructor Summary | |
ShopViewUpdater(ShopTraceMaker shopTraceMaker_)
Creates a ShopViewUpdater with a given shopTraceMaker. |
Method Summary | |
void |
addShopChangeListener(ShopChangeListener sce)
Add a listener, a ShopChangeListener that will recieve TimeMovedEvents. |
void |
setRawSpeed(int rawSpeed_)
Set the rawSpeed (between 0 and 100) |
void |
shopChanged(ShopChangeEvent sce)
Called by the ShopSimulatiom (in this manner it passes a shop change event). |
protected void |
update(double simTime)
Fires ShopTimeMovedEvents to all the listeners and tells the shopTraceMaker to display gantt. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected static final long MANDETORY_SLEEP_TIME
protected static final long MILLS_LAST_EVENT
protected static final long MAX_EVENT_SKIP
protected static final int MAX_SLEEP
protected int rawSpeed
protected ShopTraceMaker shopTraceMaker
protected java.util.ArrayList listenerList
protected ThreadFastShopRun threadFastShopRun
protected int eventCounter
protected int maxEventCount
protected double lastEventTime
protected long lastUpdateTimeMillis
protected long sleepTime
Constructor Detail |
public ShopViewUpdater(ShopTraceMaker shopTraceMaker_)
Method Detail |
public void addShopChangeListener(ShopChangeListener sce)
public void setRawSpeed(int rawSpeed_)
public void shopChanged(ShopChangeEvent sce)
shopChanged
in interface ShopChangeListener
protected void update(double simTime)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |