Class ServicePoint
java.lang.Object
eds.framework.ServicePoint
Represents a service point.
A ServicePoint maintains a queue of simulation entities and processes them
one at a time. Service times are generated using an exponential
distribution (Negexp) by default. When service is completed, a new event
is scheduled into the EventList.
-
Constructor Summary
ConstructorsConstructorDescriptionServicePoint(double meanServiceTime, EventList eventList, IEventType completionType) Creates a ServicePoint using an exponential distribution with the given mean service time.ServicePoint(Negexp generator, EventList eventList, IEventType completionType) Creates a ServicePoint with an externally provided service time generator. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ISimulationEntity entity) Adds a simulation entity to the service queue.Completes service for the current simulation entity.intReturns the current number of entities waiting in the queue.intReturns the current internal queue size, including the entity in service.booleanChecks whether there are entities waiting in the queue.booleanisBusy()Returns whether the service point is currently busy.voidStarts service for the next entity in the queue.
-
Constructor Details
-
ServicePoint
Creates a ServicePoint with an externally provided service time generator.- Parameters:
generator- service time generatoreventList- reference to the event listcompletionType- event type triggered at service completion
-
ServicePoint
Creates a ServicePoint using an exponential distribution with the given mean service time.- Parameters:
meanServiceTime- mean service time for Negexp distributioneventList- reference to the event listcompletionType- event type triggered at service completion
-
-
Method Details
-
add
Adds a simulation entity to the service queue.- Parameters:
entity- the entity to be added
-
finishService
Completes service for the current simulation entity.- Returns:
- the entity that has finished service, or null if the queue was empty
-
isBusy
public boolean isBusy()Returns whether the service point is currently busy.- Returns:
- true if processing an entity, false otherwise
-
hasOrders
public boolean hasOrders()Checks whether there are entities waiting in the queue.- Returns:
- true if the queue is not empty
-
getQueueLength
public int getQueueLength()Returns the current number of entities waiting in the queue. The entity currently in service (if any) is not counted as waiting.- Returns:
- number of waiting entities
-
getQueueSize
public int getQueueSize()Returns the current internal queue size, including the entity in service.- Returns:
- total number of queued entities
-
startService
public void startService()Starts service for the next entity in the queue. Generates a service completion event and schedules it in the EventList.
-