public final class SimQueueOSTStateHandler extends Object implements SimQueueStateHandler
SimQueueStateHandler for maintaining the per-job obtained service time,
group the jobs with identical (within a tolerance) service time,
and index these groups increasing in their members obtained service times.Copyright (C) 2005-2017 Jan de Jongh, TNO
This file is covered by the LICENSE file in the root of this project.
| Constructor and Description |
|---|
SimQueueOSTStateHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
addStartingJob(SimJob job)
Adds a starting job to the obtained-service-time administration.
|
void |
addStartingJobs(Set<SimJob> jobs)
Adds a set of starting jobs to the obtained-service-time administration.
|
String |
getHandlerName()
Returns "SimQueueOSTHandler".
|
Set<SimJob> |
getJobsWithMaximumObtainedServiceTime()
Gets all jobs with maximum obtained service time.
|
Set<SimJob> |
getJobsWithMinimumObtainedServiceTime()
Gets all jobs with minimum obtained service time.
|
Set<SimJob> |
getJobsWithObtainedServiceTime(double ost)
Gets all jobs with given obtained service time.
|
double |
getMaximumObtainedServiceTime()
Gets the maximum obtained service time.
|
double |
getMinimumObtainedServiceTime()
Gets the minimum obtained service time.
|
double |
getNextHigherThanMinimumObtainedServiceTime()
Gets the next-higher-to-minimum obtained service time.
|
double |
getNextLowerThanMaximumObtainedServiceTime()
Gets the next-lower-to-maximum obtained service time.
|
int |
getNumberOfOstGroups()
Gets the number of groups of jobs with equal obtained service times.
|
double |
getObtainedServiceTime(SimJob job)
Gets the obtained service time of given job.
|
void |
increaseMinimumObtainedServiceTime(double time,
double delta_ost,
boolean mayOvertake,
double TOLERANCE)
Increases the obtained service time on jobs with the minimum obtained service time.
|
void |
initHandler(DefaultSimQueueState queueState)
Initializes the handler, and passes the
DefaultSimQueueState object. |
boolean |
isEmpty()
Returns whether this handler has no jobs in its administration.
|
void |
removeJob(SimJob job,
boolean mustBePresent)
Removes a given job from the obtained-service-time administration.
|
void |
resetHandler(DefaultSimQueueState queueState)
Resets the (state represented by) this handler.
|
public final String getHandlerName()
getHandlerName in interface SimQueueStateHandlerpublic final void initHandler(DefaultSimQueueState queueState)
SimQueueStateHandlerDefaultSimQueueState object.
This method is called only once during registration at the DefaultSimQueueState object.
initHandler in interface SimQueueStateHandlerqueueState - The DefaultSimQueueState at which we register, non-null.DefaultSimQueueState.registerHandler(org.javades.jqueues.r5.util.predictor.state.SimQueueStateHandler)public void resetHandler(DefaultSimQueueState queueState)
SimQueueStateHandlerresetHandler in interface SimQueueStateHandlerqueueState - The DefaultSimQueueState at which we are registered, non-null.SimQueueState.reset(),
DefaultSimQueueState.reset()public final boolean isEmpty()
public final int getNumberOfOstGroups()
public final double getObtainedServiceTime(SimJob job)
job - The job, non-{code null}.IllegalArgumentException - If the job is null or non-present on the queue.public final double getMinimumObtainedServiceTime()
NoSuchElementException - If the queue is empty.isEmpty()public final double getNextHigherThanMinimumObtainedServiceTime()
NoSuchElementException - If the queue is empty, or if all jobs have equal obtained service-time.isEmpty(),
getNumberOfOstGroups()public final double getMaximumObtainedServiceTime()
NoSuchElementException - If the queue is empty.isEmpty()public final double getNextLowerThanMaximumObtainedServiceTime()
NoSuchElementException - If the queue is empty, or if all jobs have equal obtained service-time.isEmpty(),
getNumberOfOstGroups()public final void addStartingJob(SimJob job)
job - The job to add.IllegalArgumentException - If the job is null or already present.public final void addStartingJobs(Set<SimJob> jobs)
jobs - The jobs to add.IllegalArgumentException - If the set is null, or a job in it is null or already present.addStartingJob(org.javades.jqueues.r5.entity.jq.job.SimJob)public final void removeJob(SimJob job, boolean mustBePresent)
job - The job to remove.mustBePresent - Whether the job must be present a priori (sanity check).IllegalArgumentException - If the job is null.IllegalStateException - If the job is unexpectedly absent.public final void increaseMinimumObtainedServiceTime(double time,
double delta_ost,
boolean mayOvertake,
double TOLERANCE)
time - The current time.delta_ost - The increase in obtained service time per job.mayOvertake - Whether the jobs are allowed to overtake other jobs
in the ordering of jobs with equal obtained service times.TOLERANCE - The numerical tolerance in case overtaking is allowed.IllegalArgumentException - If delta_ost < 0 or if an illegal take-over takes place in terms of
obtained service times.IllegalStateException - If there are no jobs present at the queue.isEmpty()public final Set<SimJob> getJobsWithObtainedServiceTime(double ost)
ost - The obtained service time.IllegalArgumentException - If the job is not present at the queue.public final Set<SimJob> getJobsWithMinimumObtainedServiceTime()
NoSuchElementException - If the queue is empty.public final Set<SimJob> getJobsWithMaximumObtainedServiceTime()
NoSuchElementException - If the queue is empty.Copyright © 2018. All rights reserved.