public interface SimQueueState<J extends SimJob,Q extends SimQueue>
SimQueue while or as if being processed by an event list.Copyright (C) 2005-2017 Jan de Jongh, TNO
This file is covered by the LICENSE file in the root of this project.
| Modifier and Type | Method and Description |
|---|---|
void |
doArrivals(double time,
Set<J> arrivals,
Set<JobQueueVisitLog<J,Q>> visitLogs)
Adds jobs as arrivals to the queue.
|
void |
doExits(double time,
Set<J> drops,
Set<J> revocations,
Set<J> departures,
Set<J> stickers,
Set<JobQueueVisitLog<J,Q>> visitLogs)
Removes jobs from the queue.
|
void |
doStarts(double time,
Set<J> starters)
Starts jobs at the queue.
|
Map<J,Double> |
getArrivalTimesMap()
Gets a map from jobs present in the queue onto their arrival times.
|
NavigableMap<Double,List<J>> |
getJobArrivalsMap()
Returns a map of time onto jobs that arrived at that time, and are still present in the queue.
|
Map<J,Double> |
getJobRemainingServiceTimeMap()
Gets a map from all jobs in the service area onto their remaining service times.
|
default Set<J> |
getJobs()
Get the set of all jobs currently residing at the queue, either in the waiting area or in the service area.
|
default Set<J> |
getJobsInServiceArea()
Get the set of jobs currently in the service area of the queue (i.e., not waiting).
|
NavigableMap<Double,Set<J>> |
getJobsInServiceAreaMap()
Returns a map of time onto jobs that started at that time, and are still present (and thus in the service area) in the queue.
|
default Set<J> |
getJobsInWaitingArea()
Gets a set holding all the jobs waiting at the queue (in no particular order).
|
default Set<J> |
getJobsInWaitingAreaOrdered()
Gets a set holding all the jobs in the waiting area of the queue, in order of arrival.
|
Q |
getQueue()
Gets the queue, non-
null. |
NavigableMap<Double,List<J>> |
getRemainingServiceMap()
Returns a map of remaining service time onto jobs that started, have exactly that remaining service time,
and are still present (and thus in the service area) in the queue.
|
int |
getServerAccessCredits()
Gets the server-access credits.
|
Map<J,Double> |
getStartTimesMap()
Gets a map from all jobs in the service area of this queue onto their start times.
|
double |
getTime()
Gets the current time at the queue.
|
boolean |
isQueueAccessVacation()
Returns whether or not the queue is on queue-access vacation.
|
void |
reset()
Resets the state, after which it reflects the "real" queue state after a reset.
|
void |
setQueueAccessVacation(double time,
boolean start)
Starts or ends a queue-access vacation.
|
void |
setServerAccessCredits(double time,
int credits)
Sets the server-access credits.
|
void |
setTime(double time)
Sets the current time at the queue.
|
Q getQueue()
null.
The queue to which this SimQueueState refers; cannot be changed.
null.void reset()
Mimics SimEventList.reset(double).
Note that the corresponding SimQueue method is SimEntity.resetEntity().
Implementations must set the time to Double.NaN, effectively meaning
"left of" Double.NEGATIVE_INFINITY.
SimEntity.resetEntity()double getTime()
void setTime(double time)
You cannot set back the time (only through reset()).
time - The new time.IllegalArgumentException - If the time is in the past, or equal to Double.NaN.reset()boolean isQueueAccessVacation()
Mimics SimQueue.isQueueAccessVacation().
void setQueueAccessVacation(double time,
boolean start)
The time cannot be in the past.
time - The time the vacation starts or ends.start - Whether to start (true) or end (false) the vacation.
IllegalArgumentException - If time is in the past.NavigableMap<Double,List<J>> getJobArrivalsMap()
Within the list, the jobs are in arrival order. Any job can only be in one of the value lists. The value lists only holds jobs present in the system, and, vice versa, any job present in the system must be in exactly one of the value lists. Null keys or values are not allowed.
Map<J,Double> getArrivalTimesMap()
The key set of this map must be in arrival order.
Every job present in the queue must have an entry, and, vice versa, every entry refers to a job actually present in the queue. Null keys or values are not allowed.
default Set<J> getJobs()
Jobs are returned in arrival order.
Mimics SimQueue.getJobs().
The default implementation returns the key-set of getArrivalTimesMap().
null.default Set<J> getJobsInWaitingArea()
Mimics SimQueue.getJobsInWaitingArea().
The default implementation returns the set difference of
getJobs() and getJobsInServiceArea().
default Set<J> getJobsInWaitingAreaOrdered()
The default implementation returns a LinkedHashSet.
int getServerAccessCredits()
void setServerAccessCredits(double time,
int credits)
Mimics SimQueue.setServerAccessCredits(double, int).
The time cannot be in the past.
time - The time to set the credits.credits - The new remaining server-access credits, non-negative, with Integer.MAX_VALUE treated as infinity.IllegalArgumentException - If time is in the past, or credits is (strictly) negative.Map<J,Double> getStartTimesMap()
NavigableMap<Double,Set<J>> getJobsInServiceAreaMap()
Within the list, the jobs are in start order. Any job can only be in one of the value lists. The value lists only holds jobs currently in the service area of the system, and, vice versa, any job in the service area in the system must be in exactly one of the value lists. Null keys or values are not allowed.
default Set<J> getJobsInServiceArea()
Mimics SimQueue.getJobsInServiceArea().
NavigableMap<Double,List<J>> getRemainingServiceMap()
This map has no equivalence in the bare SimQueue, but the concept is used in,
for instance, processor-sharing queues.
Implementations must maintain the aggregate value set of the map returned to the set of jobs currently in the service area,
and must set the initial key for each job to the result returned from
SimJob.getServiceTime(Q).
Within the list, the jobs are in start order. Any job can only be in one of the value lists. The value lists only holds jobs currently in the service area of the system, and, vice versa, any job in the service area must be in exactly one of the value lists. Null keys or values are not allowed.
Map<J,Double> getJobRemainingServiceTimeMap()
This map has no equivalence in the bare SimQueue, but the concept is used in,
for instance, processor-sharing queues.
Implementations must maintain the key set of the map returned to the set of jobs currently in the service area,
and must set the initial value for each job to the result returned from
SimJob.getServiceTime(Q).
Values must be non-negative (but do not have to be decreasing in time!).
void doArrivals(double time,
Set<J> arrivals,
Set<JobQueueVisitLog<J,Q>> visitLogs)
The arrival time cannot be in the past.
If the queue is on queue-access vacation, the jobs are dropped (i.e., not added to this state object).
time - The arrival time.arrivals - The jobs that arrive.visitLogs - An optional set of visit log to which entries for dropped jobs (due to queue-access vacations)
are added (if the set is non-null).IllegalArgumentException - If the arrival time is in the past,
the set is null or has null members,
or contains jobs already present at the queue.isQueueAccessVacation()void doStarts(double time,
Set<J> starters)
The start time cannot be in the past.
This method updates the server-access credits, and throws an exception if there are not sufficient server-access credits to start all jobs offered.
time - The start time.starters - The jobs that start.IllegalArgumentException - If the start time is in the past, the set is null or has null members,
or contains jobs not present at the queue or jobs already started,
or there are insufficient server-access credits.getServerAccessCredits()void doExits(double time,
Set<J> drops,
Set<J> revocations,
Set<J> departures,
Set<J> stickers,
Set<JobQueueVisitLog<J,Q>> visitLogs)
The removal time cannot be in the past.
time - The removal time.drops - The jobs that drop, may be null.revocations - The jobs that are revoked, may be null.departures - The jobs that depart, may be null.stickers - The jobs that stick (never leave), may be null.visitLogs - An optional set of visit log to which entries for the leaving jobs
are added (if the set is non-null).IllegalArgumentException - If the removal time is in the past, a non-null set has null members,
the sets are not pairwise disjoint,
or any non-null set contains jobs not present at the queue,
or if effectively no job at all is presented.Copyright © 2018. All rights reserved.