J - The job type.Q - The queue type for jobs.public class DefaultSimJob<J extends DefaultSimJob,Q extends SimQueue> extends AbstractSimJob<J,Q> implements SimJob<J,Q>
SimJob with support for naming, per-queue requested service times
and a default service time.
All other methods in this class aim at influencing the result from the SimJob.getServiceTime(Q) implementation.
Copyright (C) 2005-2017 Jan de Jongh, TNO
This file is covered by the LICENSE file in the root of this project.
DefaultSimJobFactoryAbstractSimEntity.Notifier, AbstractSimEntity.PreNotificationHookSimEntity.Action, SimEntity.UnknownNotificationTypePolicy, SimEntity.UnknownOperationPolicy| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_FALLBACK_REQUESTED_SERIVE_TIME
The default fallback requested service time.
|
USE_ARRAY_OPTIMIZATION| Constructor and Description |
|---|
DefaultSimJob(org.javades.jsimulation.r5.SimEventList eventList,
String name,
double requestedServiceTime)
Creates a new
DefaultSimJob with fixed service time request at any SimQueue. |
DefaultSimJob(org.javades.jsimulation.r5.SimEventList eventList,
String name,
Map<Q,Double> requestedServiceTimeMap)
Creates a new
DefaultSimJob. |
| Modifier and Type | Method and Description |
|---|---|
double |
getFallbackRequestedServiceTime()
Returns the fallback requested service time,
in case a value could not be obtained from the internal mapping of
SimQueues
onto requested service times. |
double |
getServiceTime(Q queue)
Returns the service-time for this job for a queue visit.
|
void |
setFallbackRequestedServiceTime(double fallbackRequestedServiceTime)
Sets the fallback requested service time.
|
void |
setRequestedServiceTimeMappingForQueue(Q queue,
double serviceTime)
Sets the requested service-time for future visits to a specific queue.
|
getQueue, resetEntitySubClass, setQueueaddPendingNotification, addPendingNotification, clearAndUnlockPendingNotificationsIfLocked, delegateOperation, doAfterNotifications, doOperation, fireAndLockPendingNotifications, getEventList, getLastUpdateTime, getRegisteredDelegatedOperations, getRegisteredNotificationTypes, getRegisteredOperations, getSimEntityListeners, getUnknownNotificationTypePolicy, getUnknownOperationPolicy, isIgnoreEventListReset, notifyEventListReset, registerDelegatedOperation, registerNotificationType, registerOperation, registerPreEventHook, registerPreNotificationHook, registerPreUpdateHook, registerSimEntityListener, registerStdOutSimEntityListener, removeDelegationForOperation, resetEntity, setIgnoreEventListReset, setName, setUnknownNotificationTypePolicy, setUnknownOperationPolicy, toString, toStringDefault, unregisterSimEntityListener, unregisterStdOutSimEntityListener, updateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdoAfterNotifications, doOperation, getEventList, getLastUpdateTime, getRegisteredNotificationTypes, getRegisteredOperations, getSimEntityListeners, getUnknownNotificationTypePolicy, getUnknownOperationPolicy, isIgnoreEventListReset, registerSimEntityListener, resetEntity, setIgnoreEventListReset, setName, setUnknownNotificationTypePolicy, setUnknownOperationPolicy, toStringDefault, unregisterSimEntityListener, updatenotifyEventListResetgetQoS, getQoSClasspublic static final double DEFAULT_FALLBACK_REQUESTED_SERIVE_TIME
This is the value returned by getFallbackRequestedServiceTime() by default, i.e.,
in absence of invocations of setFallbackRequestedServiceTime(double).
public DefaultSimJob(org.javades.jsimulation.r5.SimEventList eventList,
String name,
Map<Q,Double> requestedServiceTimeMap)
DefaultSimJob.
Note that an internal copy is made of the requestedServiceTimeMap.
eventList - The event list to use, may be null.name - The name of the new job; may be null.requestedServiceTimeMap - The requested service time for each key SimQueue,
a null key can be used for unlisted SimQueues.
If the map is null or no value could be found,
getFallbackRequestedServiceTime() is used for the requested service time.public DefaultSimJob(org.javades.jsimulation.r5.SimEventList eventList,
String name,
double requestedServiceTime)
DefaultSimJob with fixed service time request at any SimQueue.
Sets the fallback requested service time, so actually,
you can later change the requested service time through setFallbackRequestedServiceTime(double).
eventList - The event list to use, may be null.name - The name of the new job; may be null.requestedServiceTime - The fixed requested service time of this job at any queue.IllegalArgumentException - If the requested service time is (strictly) negative.public final double getFallbackRequestedServiceTime()
SimQueues
onto requested service times.SimQueues
onto requested service times.DEFAULT_FALLBACK_REQUESTED_SERIVE_TIMEpublic final void setFallbackRequestedServiceTime(double fallbackRequestedServiceTime)
fallbackRequestedServiceTime - The new fallback requested service time.IllegalArgumentException - If the argument is strictly negative.getFallbackRequestedServiceTime()public double getServiceTime(Q queue)
For null arguments, this method follows the contract of SimJob.getServiceTime(Q).
Otherwise, it inspects the internal mapping of SimQueues onto service times, as explained in
DefaultSimJob(org.javades.jsimulation.r5.SimEventList, java.lang.String, double).
If the map fails to yield a service time, this method returns the result from getFallbackRequestedServiceTime().
Note that certain SimQueue types may not consult the jobs for the requested service time, but
decide it themselves!
getServiceTime in interface SimJob<J extends DefaultSimJob,Q extends SimQueue>getServiceTime in class AbstractSimJob<J extends DefaultSimJob,Q extends SimQueue>queue - The SimQueue for which the service time is requested,
if null, the service time at the current queue is used,
or zero if the job is not currently visiting a queue.SimJob.getQueue()public void setRequestedServiceTimeMappingForQueue(Q queue, double serviceTime)
This method is intended to be used before the job is actually used in a simulation. For instance, note that the setting imposed by this method survives resets of the job.
queue - The queue, non-null.serviceTime - The requested service time for that queue, zero or positive.IllegalArgumentException - If the queue is null or the requested service time is strictly negative.IllegalStateException - If the queue is the currently visited queue.getServiceTime(Q),
AbstractSimEntity.resetEntity(),
AbstractSimJob.getQueue()Copyright © 2018. All rights reserved.