|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javaSimulation.Linkage | +--javaSimulation.Link | +--javaSimulation.Process | +--haifa.shopsim.kernel.ShopRun
This class is the Process in the simulation that starts it all (the main process). It has references to the shopAlgorithm, the ShopData, the log, the shopResults, it also refences all of the entities of the simulation, the machines, the jobs, the route starts and ends.
This class is a singleton because the javaSimualtion package uses static variables for time and such, so no two shop runs can be run in the same process.
Field Summary | |
private static int |
count
Use to ensure that at most one instance of this class exists at any time. |
private Job[] |
jobs
An array of all of the jobs in the shop. |
private java.io.PrintWriter |
log
For misc output information. |
private boolean |
lowPriority
|
private Machine[] |
machines
An array of all of the machines in the shop. |
(package private) long |
MAX_SIM_TIME
A simualation may not run past this time. |
private PostRunAction |
postRunAction
|
(package private) java.util.HashMap |
restingMachines
|
private RouteEnd[] |
routeEnds
An array of all of the route ends. |
private RouteStart[] |
routeStarts
An array of all of the route starts. |
private java.lang.Thread |
run
The Thread that this class runs on. |
private ShopAlgorithm |
shopAlgorithm
A refrence to the algorithm that is asked what to do at each time epoch. |
(package private) java.util.ArrayList |
shopChangeListeners
|
private ShopData |
shopData
A reference to the shopData. |
private ShopState |
shopState
A reference to the ShopState object. |
(package private) int |
unfinishedJobs
|
Fields inherited from class javaSimulation.Process |
after, after_code, at, at_code, before, before_code, delay, delay_code, direct_code, EVTIME, MAIN, myCoroutine, PRED, prior, SQS, SUC, TERMINATED |
Constructor Summary | |
ShopRun(ShopAlgorithm shopAlgorithm_,
ShopData shopData_,
ShopState shopState_,
PostRunAction postRunAction_,
java.io.PrintWriter log_,
boolean lowPriority_)
Sets up the shop. |
Method Summary | |
void |
actions()
This method is the main corotine of the simulation (it exists for as long as the simulation exists). |
void |
addShopChangeListener(ShopChangeListener scl)
|
(package private) void |
awakenRestingMachines()
|
(package private) java.util.Map |
getQMap()
|
private void |
logPrint(java.lang.String msg)
Writes message to log, including time |
private java.util.Vector |
machinesWithSameTime(int mN)
Returns a vector of Integers of all of the machines that have the same time as the machine numbered mN. |
(package private) void |
notifyListeners(ShopChangeEvent sce)
|
(package private) boolean |
quitCalled()
Returns true if quit has been called on the algorithm. |
void |
reset()
|
void |
run()
The running thread of the simulation activates the main class. |
void |
start()
|
(package private) ShopCommand |
whatNow(int machineNumber)
Used by the Machine objects in the simulation. |
Methods inherited from class javaSimulation.Process |
|
Methods inherited from class javaSimulation.Link |
follow, into, out, precede |
Methods inherited from class javaSimulation.Linkage |
pred, prev, suc |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
Field Detail |
private static int count
private java.lang.Thread run
final long MAX_SIM_TIME
private ShopAlgorithm shopAlgorithm
private ShopData shopData
private java.io.PrintWriter log
private ShopState shopState
private PostRunAction postRunAction
private boolean lowPriority
private Machine[] machines
private Job[] jobs
private RouteStart[] routeStarts
private RouteEnd[] routeEnds
java.util.ArrayList shopChangeListeners
int unfinishedJobs
java.util.HashMap restingMachines
Constructor Detail |
public ShopRun(ShopAlgorithm shopAlgorithm_, ShopData shopData_, ShopState shopState_, PostRunAction postRunAction_, java.io.PrintWriter log_, boolean lowPriority_)
Method Detail |
void awakenRestingMachines()
public void addShopChangeListener(ShopChangeListener scl)
void notifyListeners(ShopChangeEvent sce)
java.util.Map getQMap()
ShopCommand whatNow(int machineNumber)
private java.util.Vector machinesWithSameTime(int mN)
boolean quitCalled()
public void reset()
public void start()
public void run()
run
in interface java.lang.Runnable
private void logPrint(java.lang.String msg)
public void actions()
When the method finally regains controll, it cleans up and returns, thus the simulation is over.
actions
in class javaSimulation.Process
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |