AnyLogic
Expand
Font size
All Implemented Interfaces:
AggregatableAnimationElement, HasLevel, LevelElement, LevelMarkup, SVGElement, java.io.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

All Methods Instance Methods Abstract Methods Concrete Methods 
void addService​(S s)
Adds a service point to the service.
boolean contains​(double px, double py)
Always returns false
Q getClosestQueue​(ServiceUnit<Q> serviceUnit)
Returns the queue that is the closest to the service, no matter whether it is empty or not.
Q getClosestQueueNotEmpty​(ServiceUnit<Q> serviceUnit)
Returns the non-empty queue that is the closest to the service element.
Q getLongestQueue​(ServiceUnit<Q> serviceUnit)
Returns the queue containing the maximum number of pedestrians.
java.util.List<Agent> getPeds​(Q queue)
Returns the list of agents (pedestrians) staying in the given queue
abstract java.util.List<Q> getQueues()
Returns the list of all queues of this service
java.awt.Color getServiceColor()
Returns the color of the service
java.util.List<S> getServices()
Returns the list of all service points in this service
Q getShortestQueue​(Agent agent)
Returns the queue containing the least number of pedestrians.
boolean isServiceSuspended​(ServiceUnit<Q> serviceUnit)
Returns true if the service unit is in suspended state; returns false otherwise.
void onDestroy()  
void postInitialize()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
int queueSize​(Q queue)
Returns the number of agents (pedestrians) staying in the given queue
void setDataSource​(ServiceDataSource<Q> dataSource)  
void setServiceColor​(java.awt.Color serviceColor)
Sets the color of the service
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.
Modifier and Type Method Description

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 com.anylogic.engine.markup.AbstractMarkup

discardOwner, executeUserAction, findSVGElement, getName, getSVGId, initializeInternal, isVisible, onAggregatorInitialized, onAggregatorVisibilityChanged, removeSVGFromOwner, resetSVGState, setVisible, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties

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 Detail

setDataSource

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

getServiceColor

public java.awt.Color getServiceColor()
Returns the color of the service
Returns:
the color of the service

setServiceColor

public void setServiceColor​(java.awt.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 java.util.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 java.util.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 java.util.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
How can we improve this article?