public class WorkerList
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
java.util.LinkedList<WorkerNode> |
activeList |
int |
currentDay |
java.util.LinkedList<WorkerNode> |
list |
Constructor and Description |
---|
WorkerList() |
WorkerList(int num) |
Modifier and Type | Method and Description |
---|---|
boolean |
activateWorker(int num,
int pos)
Activate one worker.
|
boolean |
deactivateWorker(int num)
Set one worker as inactive.
|
void |
finishWorker(int num)
Finish one worker with worker number.
|
double |
getExecutionTime(int num)
Get the execution time of all the workers.
|
double |
getJudgementTime(int num)
Get the time that is as criteria for load balancing operations
|
double |
getPredictedTime(int num)
Get the predicted time of all the workers.
|
int |
getSplittedWorker(int num)
Get the list that contains all the split workers.
|
boolean |
isAllDone()
Check whether all the workers have finished the simulation of current
day.
|
boolean |
isAllFinished()
Check whether all the workers have finished the whole simulation.
|
boolean |
mergeWorkers(int worker1,
int worker2)
Merge two adjacent workers
|
int |
nextSpareWorker()
Get the worker number of the next spare worker.
|
int |
numberOfActiveWorkers()
Get total number of active workers.
|
int |
numberOfSpareWorkers()
Get number of spare workers.
|
int |
numberOfWorkers()
Get total number of workers.
|
void |
splitWorker(int num)
Split one worker based on number of herds .
|
void |
startAll()
Start new day for all the workers.
|
void |
stop(int num)
Stop one worker with worker number.
|
void |
stop(int num,
double predictedTime)
Stop one worker with worker number and predicted time.
|
void |
stop(int num,
Predictor predictor,
double[] array)
Stop one worker with worker number and use a given predictor to predict
the next simulation day.
|
public java.util.LinkedList<WorkerNode> list
public java.util.LinkedList<WorkerNode> activeList
public int currentDay
public int getSplittedWorker(int num)
num
- public double getJudgementTime(int num)
num
- public double getExecutionTime(int num)
num
- public double getPredictedTime(int num)
num
- public int numberOfWorkers()
public int numberOfActiveWorkers()
public int numberOfSpareWorkers()
public void finishWorker(int num)
num
- public void startAll()
public void stop(int num, double predictedTime)
num
- public void stop(int num, Predictor predictor, double[] array)
num
- predictor
- array
- public void stop(int num)
num
- public boolean activateWorker(int num, int pos)
num
- pos
- public boolean deactivateWorker(int num)
num
- public int nextSpareWorker()
public void splitWorker(int num)
num
- public boolean mergeWorkers(int worker1, int worker2)
worker1
- worker2
- public boolean isAllFinished()
public boolean isAllDone()