AnyLogic
Expand
Font size
All Implemented Interfaces:
AggregatableAnimationElement, HasLevel, LevelElement, LevelMarkup, SVGElement, Serializable
Direct Known Subclasses:
ServiceWArea, ServiceWLine

public abstract class ServiceBase<S extends ServiceUnit<Q>,Q extends QueueUnit>
extends AbstractLevelMarkup
See Also:
Serialized Form

Method Summary

Modifier and TypeMethodDescription
voidaddService(S s)
Adds a service point to the service.
booleancontains(double px, double py)
Always returns false
QgetClosestQueue(ServiceUnit<Q> serviceUnit)
Returns the queue that is the closest to the service, no matter whether it is empty or not.
QgetClosestQueueNotEmpty(ServiceUnit<Q> serviceUnit)
Returns the non-empty queue that is the closest to the service element.
QgetLongestQueue(ServiceUnit<Q> serviceUnit)
Returns the queue containing the maximum number of pedestrians.
List<Agent>getPeds(Q queue)
Returns the list of agents (pedestrians) staying in the given queue
abstract List<Q>getQueues()
Returns the list of all queues of this service
ColorgetServiceColor()
Returns the color of the service
List<S>getServices()
Returns the list of all service points in this service
QgetShortestQueue(Agent agent)
Returns the queue containing the least number of pedestrians.
booleanisServiceSuspended(ServiceUnit<Q> serviceUnit)
Returns true if the service unit is in suspended state; returns false otherwise.
voidonDestroy() 
voidpostInitialize()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
intqueueSize(Q queue)
Returns the number of agents (pedestrians) staying in the given queue
voidsetDataSource(ServiceDataSource<Q> dataSource) 
voidsetServiceColor(Color serviceColor)
Sets the color of the service
voidsetServiceSuspended(ServiceUnit<Q> serviceUnit, boolean suspended)
Sets the service unit to suspended state if the suspended value is true; sets the service unit to active state otherwise.

Methods inherited from class com.anylogic.engine.markup.AbstractLevelMarkup

getDrawMode, getLevel, setLevel

Methods inherited from class com.anylogic.engine.markup.MarkupShape

error, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, onAggregatorVisibilityChanged

Method Details

setDataSource

@AnyLogicInternalAPI
public void setDataSource(ServiceDataSource<Q> dataSource)

getServiceColor

public Color getServiceColor()
Returns the color of the service
Returns:
the color of the service

setServiceColor

public void setServiceColor(Color serviceColor)
Sets the color of the service
Parameters:
serviceColor - new color

addService

public void addService(S s)
Adds a service point to the service. The service should be uninitialized
Parameters:
s - service point

getServices

public List<S> getServices()
Returns the list of all service points in this service
Returns:
the list of all service points in this service

getQueues

public abstract List<Q> getQueues()
Returns the list of all queues of this service
Returns:
the list of all queues of this service

contains

public boolean contains(double px,
 double py)
Always returns false
Specified by:
contains in class MarkupShape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

postInitialize

@AnyLogicInternalAPI
public void postInitialize()
Description copied from interface: AggregatableAnimationElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

onDestroy

@AnyLogicInternalCodegenAPI
public void onDestroy()

queueSize

public int queueSize(Q queue)
Returns the number of agents (pedestrians) staying in the given queue
Parameters:
queue - the queue
Returns:
the number of peds in the queue

getPeds

public List<Agent> getPeds(Q queue)
Returns the list of agents (pedestrians) staying in the given queue
Parameters:
queue - the queue
Returns:
the list of peds in the queue

getClosestQueue

public Q getClosestQueue(ServiceUnit<Q> serviceUnit)
Returns the queue that is the closest to the service, no matter whether it is empty or not.
Parameters:
serviceUnit - service point
Returns:
the queue that is closest to the service

getClosestQueueNotEmpty

public Q getClosestQueueNotEmpty(ServiceUnit<Q> serviceUnit)
Returns the non-empty queue that is the closest to the service element.
Parameters:
serviceUnit - service point
Returns:
closest non-empty queue

getShortestQueue

public Q getShortestQueue(Agent agent)
Returns the queue containing the least number of pedestrians.
Parameters:
agent - the agent
Returns:
the queue containing the least number of pedestrians.

getLongestQueue

public Q getLongestQueue(ServiceUnit<Q> serviceUnit)
Returns the queue containing the maximum number of pedestrians.
Parameters:
serviceUnit - service point
Returns:
the queue containing the maximum number of pedestrians.

isServiceSuspended

public boolean isServiceSuspended(ServiceUnit<Q> serviceUnit)
Returns true if the service unit is in suspended state; returns false otherwise. A suspended element is inactive and does not accept pedestrians.
Parameters:
serviceUnit - the service unit
Returns:
true if the service unit is in suspended state; returns false otherwise

setServiceSuspended

public void setServiceSuspended(ServiceUnit<Q> serviceUnit,
 boolean suspended)
Sets the service unit to suspended state if the suspended value is true; sets the service unit to active state otherwise.
Parameters:
serviceUnit - the service unit
suspended - the suspended value