AnyLogic
Expand
Font size
All Implemented Interfaces:
QueueUnit, Serializable
Direct Known Subclasses:
QueueSerpentine

public class QueuePath
extends AbstractMarkupSubunit<ServiceWLine<?>>
implements QueueUnit
See Also:
Serialized Form

Constructor Summary

ConstructorDescription
QueuePath(int capacity, ExceededQueuePolicy exceededQueuePolicy, MarkupSegment... segments) 
QueuePath(ExceededQueuePolicy exceededQueuePolicy, MarkupSegment... segments)
Creates queue with unlimited capacity and the given policy for processing in case of full queue
QueuePath(MarkupSegment... segments)
Creates queue with unlimited capacity

Method Summary

Modifier and TypeMethodDescription
voidaddSegment(MarkupSegment segment)
Adds segment to this markup element
voidarcTo(double x, double y, double startAngle, double endAngle, double ratioStartToEnd)
Adds arc segment with two circular arcs (available for markup elements created with no-argument constructor)
intcapacity()
Returns the capacity of the queue
booleancontains(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
booleancontains(double px, double py, double distance)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
booleancontainsSq(double px, double py, double squareDistance)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
BoundingRectanglegetBoundingRectangle() 
Rectangle2DgetBounds()
Deprecated.
PointgetEndPoint()
Returns the location of the end point
PointgetEndPoint(Point out)
Returns the location of the end point
PositiongetEndPosition()
Returns the end position
PositiongetEndPosition(Position out)
Returns the end position
ExceededQueuePolicygetExceededQueuePolicy()
Returns the behavior policy to handle the case when queue capacity is exceeded
doublegetNearestPoint(double x, double y, Point out)
Calculates (using the output object) the point in this space markup element nearest to the given (x, y) point.
List<Agent>getPeds()
Returns the list of peds currently staying in the queue
final PositiongetPositionAtOffset(double offset, Position out)
Returns the point located on the markup element with the given offset distance calculated from start point.
final PositiongetPositionAtOffsetFromEnd(double offset, Position out)
Returns the point located on the markup element with the given offset distance calculated from end point.
MarkupSegmentgetSegment(int index)
Returns the segment by its index
intgetSegmentCount()
Returns the number of segments
PointgetStartPoint()
Returns the location of the start point
PointgetStartPoint(Point out)
Returns the location of the start point
PositiongetStartPosition()
Returns the start position
PositiongetStartPosition(Position out)
Returns the start position
booleanisCapacityLimited()
Returns true if this queue has limited capacity
booleanisReverse()
Returns true if the queue is reverse; returns false otherwise.
Iterator<MarkupSegment>iterator()
Creates and returns read-only iterator over segments
final doublelength()
Returns the length of the markup element.
voidlineTo(double x, double y)
Adds line segment (available for markup elements created with no-argument constructor)
voidsetCapacity(int capacity)
Sets the capacity of queue
intsize()
Returns the number of agents (pedestrians) staying in the queue
voidstartDrawing(double x, double y)
Starts drawing (available for markup elements created with no-argument constructor)

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

getName, getOwner

Methods inherited from class java.lang.Object

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

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

getName

Constructor Details

QueuePath

public QueuePath(MarkupSegment... segments)
Creates queue with unlimited capacity
Parameters:
segments -

QueuePath

public QueuePath(ExceededQueuePolicy exceededQueuePolicy,
 MarkupSegment... segments)
Creates queue with unlimited capacity and the given policy for processing in case of full queue
Parameters:
segments -
the - policy for the case when the queue is full

QueuePath

public QueuePath(int capacity,
 ExceededQueuePolicy exceededQueuePolicy,
 MarkupSegment... segments)

Method Details

size

public int size()
Returns the number of agents (pedestrians) staying in the queue
Specified by:
size in interface QueueUnit
Returns:
the number of peds in the queue

getPeds

public List<Agent> getPeds()
Returns the list of peds currently staying in the queue
Specified by:
getPeds in interface QueueUnit
Returns:
the collection of agents in this queue

setCapacity

public void setCapacity(int capacity)
Sets the capacity of queue
Parameters:
capacity - the new capacity value

isCapacityLimited

public boolean isCapacityLimited()
Description copied from interface: QueueUnit
Returns true if this queue has limited capacity
Specified by:
isCapacityLimited in interface QueueUnit
Returns:
true if this queue has limited capacity, false otherwise
See Also:
QueueUnit.capacity()

capacity

public int capacity()
Description copied from interface: QueueUnit
Returns the capacity of the queue
Specified by:
capacity in interface QueueUnit
Returns:
the capacity of the queue
See Also:
QueueUnit.isCapacityLimited()

getExceededQueuePolicy

public ExceededQueuePolicy getExceededQueuePolicy()
Returns the behavior policy to handle the case when queue capacity is exceeded
Returns:
possible return values are:
  • EXCEEDED_QUEUE_EXTEND_TO_THE_FREE_SPACE
  • EXCEEDED_QUEUE_CROWD_ROUND_AT_THE_END
  • isReverse

    public boolean isReverse()
    Returns true if the queue is reverse; returns false otherwise.
    Returns:
    true if the queue is reverse; returns false otherwise.

    contains

    public boolean contains(double px,
     double py)
    Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
    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

    contains

    public boolean contains(double px,
     double py,
     double distance)
    Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y), using the given tolerance
    Parameters:
    px - the x coordinate relative to this shape's container
    py - the y coordinate relative to this shape's container
    squareDistance - the square of distance tolerance to determine whether the given point lies on the markup element line or not
    Returns:
    true if the shape contains the point with the given coordinates

    containsSq

    public boolean containsSq(double px,
     double py,
     double squareDistance)
    Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y), using the given tolerance
    Parameters:
    px - the x coordinate relative to this shape's container
    py - the y coordinate relative to this shape's container
    squareDistance - the square of distance tolerance to determine whether the given point lies on the markup element line or not
    Returns:
    true if the shape contains the point with the given coordinates

    startDrawing

    public void startDrawing(double x,
     double y)
    Starts drawing (available for markup elements created with no-argument constructor)
    Parameters:
    x - the x coordinate of the first point
    y - the y coordinate of the first point

    lineTo

    public void lineTo(double x,
     double y)
    Adds line segment (available for markup elements created with no-argument constructor)
    Parameters:
    x - the x coordinate of the segment end point
    y - the y coordinate of the segment end point

    arcTo

    public void arcTo(double x,
     double y,
     double startAngle,
     double endAngle,
     double ratioStartToEnd)
    Adds arc segment with two circular arcs (available for markup elements created with no-argument constructor)
    Parameters:
    x - the x coordinate of the segment end point
    y - the y coordinate of the segment end point
    startAngle - orientation of segment line start
    endAngle - orientation of segment line end
    ratioStartToEnd - ratio between two circular arcs

    addSegment

    public void addSegment(MarkupSegment segment)
    Adds segment to this markup element
    Parameters:
    segment - the segment, should be initialized if was created using no-argument constructor

    getSegmentCount

    public int getSegmentCount()
    Returns the number of segments
    Returns:
    the number of segments

    getSegment

    public MarkupSegment getSegment(int index)
    Returns the segment by its index
    Parameters:
    index - the segment index, [0 .. getSegmentCount() - 1]
    Returns:
    the segment

    iterator

    public Iterator<MarkupSegment> iterator()
    Creates and returns read-only iterator over segments

    getStartPoint

    public Point getStartPoint(Point out)
    Returns the location of the start point
    Parameters:
    out - output object to write to, may be null
    Returns:
    the Point object with coordinates of the first point

    getStartPoint

    public Point getStartPoint()
    Returns the location of the start point
    Returns:
    the Point object with coordinates of the first point

    getEndPoint

    public Point getEndPoint(Point out)
    Returns the location of the end point
    Parameters:
    out - output object to write to, may be null
    Returns:
    the Point object with coordinates of the last point

    getEndPoint

    public Point getEndPoint()
    Returns the location of the end point
    Returns:
    the Point object with coordinates of the last point

    getStartPosition

    public Position getStartPosition(Position out)
    Returns the start position
    Parameters:
    out - output object to write to, may be null
    Returns:
    the Position object with coordinates of the first position

    getStartPosition

    public Position getStartPosition()
    Returns the start position
    Returns:
    the Position object with coordinates of the first position

    getEndPosition

    public Position getEndPosition(Position out)
    Returns the end position
    Parameters:
    out - output object to write to, may be null
    Returns:
    the Position object with coordinates of the last position

    getEndPosition

    public Position getEndPosition()
    Returns the end position
    Returns:
    the Position object with coordinates of the last position

    length

    public final double length()
    Returns the length of the markup element.
    Returns:
    the length of the markup element (measured in pixels), a positive number

    getBounds

    @Deprecated
    public Rectangle2D getBounds()
    Deprecated.

    getPositionAtOffset

    public final Position getPositionAtOffset(double offset,
     Position out)
    Returns the point located on the markup element with the given offset distance calculated from start point.
    Parameters:
    offset - offset, non-negative value, should be less or equal to the full length.
    out - output object to write to, may be null
    Returns:
    the Position object with coordinates of the point with the given offset and orientation along markup element line at this point

    getPositionAtOffsetFromEnd

    public final Position getPositionAtOffsetFromEnd(double offset,
     Position out)
    Returns the point located on the markup element with the given offset distance calculated from end point.
    Parameters:
    offset - offset, non-negative value, should be less or equal to the full length.
    out - output object to write to, may be null
    Returns:
    the Position object with coordinates of the point with the given offset and orientation along markup element line at this point

    getNearestPoint

    public double getNearestPoint(double x,
     double y,
     Point out)
    Calculates (using the output object) the point in this space markup element nearest to the given (x, y) point. Returns the square of distance to the point (in the XY-projection). All the calculations are performed in the horizontal projection (z-coordinates aren't used, as if all of the z coordinates were zero).
    Parameters:
    x - x coordinate of the point
    y - y coordinate of the point
    output - the output point to write result to. Note that output.z is left unchanged.
    Returns:
    the square of distance to the nearest point in the horizontal (XY) projection

    getBoundingRectangle

    @AnyLogicInternalAPI
    public BoundingRectangle getBoundingRectangle()