AnyLogic
Expand
Font size
Type Parameters:
E - type of agent extension to delegate to. If you are creating new extension based on 'continuous or GIS space agent', please set the type to ExtAgentWithSpatialMetrics
All Implemented Interfaces:
AgentExtension, ExtAgentWithSpatialMetrics, ExtAnimationParams, java.io.Serializable
Direct Known Subclasses:
ExtEntityDelegate

@AnyLogicInternalAPI
public abstract class ExtAgentWithSpatialMetricsDelegate<E extends ExtAgentWithSpatialMetrics>
extends AgentExtensionImpl
implements ExtAgentWithSpatialMetrics
Base class for extensions delegating their 'Continuous / GIS space agent' activity to an existing extension of agent
See Also:
Serialized Form

Field Summary

Fields inherited from interface com.anylogic.engine.AgentExtension

P_AGENT_INTERACTIVE_DELEGATE, P_AGENT_WITH_SPATIAL_METRICS_DELEGATE, P_AGENT_WITH_SPECIFIC_SPACE, P_AGENT_WITH_SPECIFIC_SPACE_DELEGATE, P_ENTITY_DELEGATE, P_ENV_WITH_SPECIFIC_SPACE, P_ROOT, P_SPACE, P_USER_EXT

Constructor Summary

Constructors 
ExtAgentWithSpatialMetricsDelegate​(Agent owner)  
Constructor Description

Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
<T extends Agent>
java.util.List<T>
agentsInRange​(java.lang.Iterable<T> agents, double distance)
Returns the unsorted list of agents from the given collection which are within the given distance from this agent
<T extends Agent>
java.util.List<T>
agentsInRange​(java.lang.Iterable<T> agents, double distance, LengthUnits units)
Returns the unsorted list of agents from the given collection which are within the given distance from this agent
double distanceTo​(double x, double y)
Calculates the distance from this agent to a given point in the projection to the horizontal plane (i.e.
double distanceTo​(double x, double y, LengthUnits units)
Calculates the distance from this agent to a given point in the projection to the horizontal plane (i.e.
double distanceTo​(Agent other)
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type.
double distanceTo​(Agent other, LengthUnits units)
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type.
double distanceTo​(Point point)
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type.
double distanceTo​(Point point, LengthUnits units)
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type.
E e()  
abstract java.lang.Class<E> extClass()  
Position getAnimationPosition​(Position out)  
double getAnimationX()  
double getAnimationY()  
double getAnimationZ()  
Level getLevel()
Returns the level this agent lives in, actual for agents in continuous space.
<T extends Agent>
T
getNearestAgent​(java.lang.Iterable<T> agents)
Returns the nearest agent from the given collection
INetwork getNetwork()
Returns the network this agent lives in, actual for agents in continuous space.
INode getNetworkNode()
Returns the network node this agent currently is located in, actual for agents in continuous space.
double getPresentationScaleOnOwnerSpace()
Returns the scale of the agent presentation animation on its space or 1.0 if space isn't defined or agent list is empty
IRouteProvider getRouteProvider()
Returns the provider of routes for agent movement
Agent getSpace()
Returns the agent representing space this agent lives in
SpaceType getSpaceType()
Returns the type of space this agent lives in, one of SPACE_CONTINUOUS, SPACE_GIS
double getSpeed()
Returns the current value of the agent speed (measured in m/s).
double getSpeed​(SpeedUnits units)
Returns the current value of the agent speed.
double getTargetX()
Returns the x of the target location if moving, otherwise current x.
The exact behavior of this method depends on the underlying space type.
double getTargetY()
Returns the y of the target location if moving, otherwise current y.
The exact behavior of this method depends on the underlying space type.
double getVelocity()
Deprecated.
boolean isAnimationVisible_xjal()  
boolean isAutomaticHorizontalRotation()
Returns true if agent is set to be rotated (in horizontal plane) during movement, false otherwise
boolean isAutomaticVerticalRotation()
This functions is valid only for specific set of spaces
boolean isMoving()
Tests if the agent is currently moving.
void jumpTo​(double x, double y)
Instantly moves the agent to a given location (without changes to Z-coordinate, if any).
void jumpTo​(INode node, Point location)
Instantly moves the agent to a given network location.
void jumpTo​(Point location)
Instantly moves the agent to a given location.
void moveTo​(double x, double y)
Starts movement in the direction of the given target location.
void moveTo​(INode node, Point location)
Starts movement to the given network node.
"On arrival" code is executed when movement is finished.
void moveTo​(Point location)
Starts movement in the direction of the given target location.
"On arrival" code is executed when movement is finished.
void moveToInTime​(double x, double y, double tripTime)
Starts movement in the direction of the given target location.
void moveToInTime​(double x, double y, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location.
void moveToInTime​(INode node, Point location, double tripTime)
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
void moveToInTime​(INode node, Point location, double tripTime, TimeUnits units)
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
void moveToInTime​(Point location, double tripTime)
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
void moveToInTime​(Point location, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
void moveToNearestAgent​(java.lang.Iterable<? extends Agent> agents)
Starts movement to the nearest agent from the given collection.
void moveToNearestAgent​(java.lang.Iterable<? extends Agent> agents, double tripTime)
Starts movement to the nearest agent from the given collection.
void moveToStraight​(Point location)
Starts straight movement in the direction of the given target location.
"On arrival" code is executed when movement is finished.
void moveToStraightInTime​(Point location, double tripTime)
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
void moveToStraightInTime​(Point location, double tripTime, TimeUnits units)
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
void onExtensionRemoved​(AgentExtension ext)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Default implementation does nothing
int priority()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
This function is used for sorting extensions (in order for the overriding delegation to work)
void setArrivalCallback​(ArrivalCallback arrivalCallback)
This method is designed for advanced users and library developers, for general purpose arrival processing please use "On arrival" action which can be found on the properties of Agent Type.
Sets the listener which will be notified when the agent arrives (onArrival) or when the agent movement is cancelled or redirected (onCancel).
void setAutomaticHorizontalRotation​(boolean yes)
Tells agent to rotate automatically (in horizontal plane) during movements.
void setLevel​(Level level)
Sets this agent to live in the level, actual for agents in continuous space.
void setNetwork​(INetwork network)
Sets this agent to live in the network, actual for agents in continuous space.
void setNetworkInternal​(INetwork network, INode node, Position location)  
void setNetworkNode​(INode node)
Sets the current network location for the agent
void setNetworkNode​(INode node, Point position)
Sets the current network location for the agent
void setRouteProvider​(IRouteProvider routeProvider)
Stops agent If it is moving.
void setSpace​(Agent space)
Sets the space for agent.
void setSpeed​(double speedInMPS)
Changes speed of the agent (measured in m/s).
If the agent is moving, it continues moving with the new speed.
void setSpeed​(double s, SpeedUnits units)
Changes speed of the agent (the units of the value depend on the specific space type).
If the agent is moving, it continues moving with the new speed.
void setVelocity​(double v)
Deprecated.
void stop()
Stops movement, if any.
double timeToArrival()
Returns the time to arrival to the target location, in model-time units.
If the agent is not moving, returns 0.
double timeToArrival​(TimeUnits units)
Returns the time to arrival to the target location, in time units.
If the agent is not moving, returns 0.
void updatePosition()
Updates agent coordinates
Modifier and Type Method Description

Methods inherited from class com.anylogic.engine.AgentExtensionImpl

error, error, getAgent, getSupportedInterfaces_xjal, next_xjal, onDestroy, setNext_xjal, supportsInterface_xjal

Methods inherited from class java.lang.Object

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

Methods inherited from interface com.anylogic.engine.AgentExtension

getAgent, next_xjal, onDestroy, setNext_xjal, supportsInterface_xjal

Constructor Detail

ExtAgentWithSpatialMetricsDelegate

public ExtAgentWithSpatialMetricsDelegate​(Agent owner)

Method Detail

setSpace

public void setSpace​(Agent space)
Description copied from interface: ExtAnimationParams
Sets the space for agent. Shouldn't be called for moving agents. Coordinates and rotations are left "as is"
Specified by:
setSpace in interface ExtAnimationParams
Parameters:
space - the agent representing space this agent will live in

stop

public void stop()
Description copied from interface: ExtAgentWithSpatialMetrics
Stops movement, if any.
Specified by:
stop in interface ExtAgentWithSpatialMetrics

moveTo

public void moveTo​(double x,
                   double y)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement in the direction of the given target location. Z coordinate of target is the same as the current agent's Z coordinate.
"On arrival" code is executed when movement is finished.
Specified by:
moveTo in interface ExtAgentWithSpatialMetrics
Parameters:
x - the x coordinate of the target location
y - the y coordinate of the target location

getSpace

public Agent getSpace()
Description copied from interface: ExtAnimationParams
Returns the agent representing space this agent lives in
Specified by:
getSpace in interface ExtAnimationParams
Returns:
the agent representing space this agent lives in

getAnimationX

public double getAnimationX()
Specified by:
getAnimationX in interface ExtAnimationParams

getAnimationY

public double getAnimationY()
Specified by:
getAnimationY in interface ExtAnimationParams

getAnimationZ

public double getAnimationZ()
Specified by:
getAnimationZ in interface ExtAnimationParams

getAnimationPosition

public Position getAnimationPosition​(Position out)
Specified by:
getAnimationPosition in interface ExtAnimationParams

getPresentationScaleOnOwnerSpace

public double getPresentationScaleOnOwnerSpace()
Description copied from interface: ExtAnimationParams
Returns the scale of the agent presentation animation on its space or 1.0 if space isn't defined or agent list is empty
Specified by:
getPresentationScaleOnOwnerSpace in interface ExtAnimationParams
Returns:
the scale of presentation animation on owner space

moveTo

public void moveTo​(Point location)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement in the direction of the given target location.
"On arrival" code is executed when movement is finished.
Specified by:
moveTo in interface ExtAgentWithSpatialMetrics
Parameters:
location - the target location

moveToInTime

public void moveToInTime​(Point location,
                         double tripTime)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
Specified by:
moveToInTime in interface ExtAgentWithSpatialMetrics
Parameters:
location - the target location
tripTime - the time of the movement trip

moveToStraight

public void moveToStraight​(Point location)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts straight movement in the direction of the given target location.
"On arrival" code is executed when movement is finished.
Specified by:
moveToStraight in interface ExtAgentWithSpatialMetrics
Parameters:
location - the target location

moveToStraightInTime

public void moveToStraightInTime​(Point location,
                                 double tripTime)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
Specified by:
moveToStraightInTime in interface ExtAgentWithSpatialMetrics
Parameters:
location - the target location
tripTime - the time of the movement trip

moveToStraightInTime

public void moveToStraightInTime​(Point location,
                                 double tripTime,
                                 TimeUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
Specified by:
moveToStraightInTime in interface ExtAgentWithSpatialMetrics
Parameters:
location - the target location
tripTime - the time of the movement trip
units - the time units

isAnimationVisible_xjal

public boolean isAnimationVisible_xjal()
Specified by:
isAnimationVisible_xjal in interface ExtAnimationParams

moveToInTime

public void moveToInTime​(Point location,
                         double tripTime,
                         TimeUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
Specified by:
moveToInTime in interface ExtAgentWithSpatialMetrics
Parameters:
location - the target location
tripTime - the time of the movement trip
units - the time units

moveTo

public void moveTo​(INode node,
                   Point location)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement to the given network node.
"On arrival" code is executed when movement is finished.
Specified by:
moveTo in interface ExtAgentWithSpatialMetrics
Parameters:
node - the network node.
location - (optional) location within node, may be null

moveToInTime

public void moveToInTime​(double x,
                         double y,
                         double tripTime)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement in the direction of the given target location. (in case of 3D space, Z coordinate of target is the same as the current agent's Z coordinate.
"On arrival" code is executed when movement is finished.
The exact behavior of this method depends on the underlying space type.
Specified by:
moveToInTime in interface ExtAgentWithSpatialMetrics
Parameters:
x - the x coordinate of the target location
y - the y coordinate of the target location
tripTime - the time of the movement trip

moveToInTime

public void moveToInTime​(double x,
                         double y,
                         double tripTime,
                         TimeUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement in the direction of the given target location. (in case of 3D space, Z coordinate of target is the same as the current agent's Z coordinate.
"On arrival" code is executed when movement is finished.
The exact behavior of this method depends on the underlying space type.
Specified by:
moveToInTime in interface ExtAgentWithSpatialMetrics
Parameters:
x - the x coordinate of the target location
y - the y coordinate of the target location
tripTime - the time of the movement trip
units - the time units

moveToInTime

public void moveToInTime​(INode node,
                         Point location,
                         double tripTime)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
Specified by:
moveToInTime in interface ExtAgentWithSpatialMetrics
Parameters:
node - the network node.
location - (optional) location within node, may be null
tripTime - the time of the movement trip

moveToInTime

public void moveToInTime​(INode node,
                         Point location,
                         double tripTime,
                         TimeUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in tripTime model time units.
"On arrival" code is executed when movement is finished.
Specified by:
moveToInTime in interface ExtAgentWithSpatialMetrics
Parameters:
node - the network node.
location - (optional) location within node, may be null
tripTime - the time of the movement trip
units - the time units

jumpTo

public void jumpTo​(double x,
                   double y)
Description copied from interface: ExtAgentWithSpatialMetrics
Instantly moves the agent to a given location (without changes to Z-coordinate, if any). Terminates any movement.
The exact behavior of this method depends on the underlying space type.
Doesn't call "on arrival" code
Specified by:
jumpTo in interface ExtAgentWithSpatialMetrics
Parameters:
x - the x coordinate of the new location
y - the y coordinate of the new location

jumpTo

public void jumpTo​(Point location)
Description copied from interface: ExtAgentWithSpatialMetrics
Instantly moves the agent to a given location. Terminates any movement.
Doesn't call "on arrival" code
Specified by:
jumpTo in interface ExtAgentWithSpatialMetrics
Parameters:
location - the new location

jumpTo

public void jumpTo​(INode node,
                   Point location)
Description copied from interface: ExtAgentWithSpatialMetrics
Instantly moves the agent to a given network location. Terminates any movement.
Doesn't call "on arrival" code
Specified by:
jumpTo in interface ExtAgentWithSpatialMetrics
Parameters:
node - the network node.
location - (optional) location within node, may be null

setArrivalCallback

public void setArrivalCallback​(ArrivalCallback arrivalCallback)
Description copied from interface: ExtAgentWithSpatialMetrics
This method is designed for advanced users and library developers, for general purpose arrival processing please use "On arrival" action which can be found on the properties of Agent Type.
Sets the listener which will be notified when the agent arrives (onArrival) or when the agent movement is cancelled or redirected (onCancel). The agent should be stopped at the time this method is called and should have no arrival callback set, otherwise this method will throw an error.
The arrival callback is automatically forgotten once notified.
Specified by:
setArrivalCallback in interface ExtAgentWithSpatialMetrics
Parameters:
arrivalCallback - the listener which will be notified about agent's arrival

moveToNearestAgent

public void moveToNearestAgent​(java.lang.Iterable<? extends Agent> agents)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement to the nearest agent from the given collection. Stops any current movement.
Specified by:
moveToNearestAgent in interface ExtAgentWithSpatialMetrics
Parameters:
agents - the collection of agents

moveToNearestAgent

public void moveToNearestAgent​(java.lang.Iterable<? extends Agent> agents,
                               double tripTime)
Description copied from interface: ExtAgentWithSpatialMetrics
Starts movement to the nearest agent from the given collection. Stops any current movement.
Changes the speed of the agent in order to reach target in tripTime model time units.
Specified by:
moveToNearestAgent in interface ExtAgentWithSpatialMetrics
Parameters:
agents - the collection of agents
tripTime - the time of the movement trip

getNearestAgent

public <T extends Agent> T getNearestAgent​(java.lang.Iterable<T> agents)
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the nearest agent from the given collection
Specified by:
getNearestAgent in interface ExtAgentWithSpatialMetrics
Parameters:
agents - the collection of agents
Returns:
the nearest agent (never this one) or null if the collection is empty

agentsInRange

public <T extends Agent> java.util.List<T> agentsInRange​(java.lang.Iterable<T> agents,
                                                         double distance)
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the unsorted list of agents from the given collection which are within the given distance from this agent
Specified by:
agentsInRange in interface ExtAgentWithSpatialMetrics
Parameters:
agents - the collection of agents
Returns:
the list of agents within the given distance, unsorted

agentsInRange

public <T extends Agent> java.util.List<T> agentsInRange​(java.lang.Iterable<T> agents,
                                                         double distance,
                                                         LengthUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the unsorted list of agents from the given collection which are within the given distance from this agent
Specified by:
agentsInRange in interface ExtAgentWithSpatialMetrics
Parameters:
agents - the collection of agents
Returns:
the list of agents within the given distance, unsorted

setAutomaticHorizontalRotation

public void setAutomaticHorizontalRotation​(boolean yes)
Description copied from interface: ExtAgentWithSpatialMetrics
Tells agent to rotate automatically (in horizontal plane) during movements.
Specified by:
setAutomaticHorizontalRotation in interface ExtAgentWithSpatialMetrics
Parameters:
yes - true - agent will be rotated during movement, false - rotation will not be changed
See Also:
#setRotation(double)

isAutomaticHorizontalRotation

public boolean isAutomaticHorizontalRotation()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns true if agent is set to be rotated (in horizontal plane) during movement, false otherwise
Specified by:
isAutomaticHorizontalRotation in interface ExtAgentWithSpatialMetrics
Returns:
true if agent is set to be rotated during movement
See Also:
ExtAgentWithSpatialMetrics.setAutomaticHorizontalRotation(boolean)

getTargetX

public double getTargetX()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the x of the target location if moving, otherwise current x.
The exact behavior of this method depends on the underlying space type.
Specified by:
getTargetX in interface ExtAgentWithSpatialMetrics
Returns:
the x of the target location if moving, otherwise current x

getTargetY

public double getTargetY()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the y of the target location if moving, otherwise current y.
The exact behavior of this method depends on the underlying space type.
Specified by:
getTargetY in interface ExtAgentWithSpatialMetrics
Returns:
the y of the target location if moving, otherwise current y

distanceTo

public double distanceTo​(Agent other)
Description copied from interface: ExtAgentWithSpatialMetrics
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type.
Specified by:
distanceTo in interface ExtAgentWithSpatialMetrics
Parameters:
other - another agent
Returns:
the distance to the other agent

distanceTo

public double distanceTo​(Agent other,
                         LengthUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type.
Specified by:
distanceTo in interface ExtAgentWithSpatialMetrics
Parameters:
other - another agent
units - the units of length
Returns:
the distance to the other agent

distanceTo

public double distanceTo​(Point point)
Description copied from interface: ExtAgentWithSpatialMetrics
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type.
Specified by:
distanceTo in interface ExtAgentWithSpatialMetrics
Returns:
the distance to the point

distanceTo

public double distanceTo​(Point point,
                         LengthUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type.
Specified by:
distanceTo in interface ExtAgentWithSpatialMetrics
units - the units of length
Returns:
the distance to the point

distanceTo

public double distanceTo​(double x,
                         double y)
Description copied from interface: ExtAgentWithSpatialMetrics
Calculates the distance from this agent to a given point in the projection to the horizontal plane (i.e. agent's Z coordinate isn't used in the calculation).
Specified by:
distanceTo in interface ExtAgentWithSpatialMetrics
Parameters:
x - the x coordinate of the point
y - the y coordinate of the point
Returns:
the distance of Agent's projection (on the plane Z=0) to the point (x,y)

distanceTo

public double distanceTo​(double x,
                         double y,
                         LengthUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Calculates the distance from this agent to a given point in the projection to the horizontal plane (i.e. agent's Z coordinate isn't used in the calculation).
Specified by:
distanceTo in interface ExtAgentWithSpatialMetrics
Parameters:
x - the x coordinate of the point
y - the y coordinate of the point
units - the units of lengths
Returns:
the distance of Agent's projection (on the plane Z=0) to the point (x,y)

isMoving

public boolean isMoving()
Description copied from interface: ExtAgentWithSpatialMetrics
Tests if the agent is currently moving.
Specified by:
isMoving in interface ExtAgentWithSpatialMetrics
Returns:
true if the agent is moving, false otherwise

setVelocity

@Deprecated
public void setVelocity​(double v)
Deprecated.
Description copied from interface: ExtAgentWithSpatialMetrics
Changes speed of the agent (the units of the value depend on the specific space type).
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
Specified by:
setVelocity in interface ExtAgentWithSpatialMetrics
Parameters:
v - the new speed

getVelocity

@Deprecated
public double getVelocity()
Deprecated.
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the current value of the agent speed. The units of the returned value depend on the specific space type.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
Specified by:
getVelocity in interface ExtAgentWithSpatialMetrics
Returns:
the current value of agent speed

setSpeed

public void setSpeed​(double speedInMPS)
Description copied from interface: ExtAgentWithSpatialMetrics
Changes speed of the agent (measured in m/s).
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
Specified by:
setSpeed in interface ExtAgentWithSpatialMetrics

setSpeed

public void setSpeed​(double s,
                     SpeedUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Changes speed of the agent (the units of the value depend on the specific space type).
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
Specified by:
setSpeed in interface ExtAgentWithSpatialMetrics
Parameters:
s - the new speed
units - the units of speed

getSpeed

public double getSpeed()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the current value of the agent speed (measured in m/s). The units of the returned value depend on the specific space type.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
Specified by:
getSpeed in interface ExtAgentWithSpatialMetrics
Returns:
the current value of agent speed, meters per second

getSpeed

public double getSpeed​(SpeedUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the current value of the agent speed. The units of the returned value depend on the specific space type.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
Specified by:
getSpeed in interface ExtAgentWithSpatialMetrics
Parameters:
units - the units of speed
Returns:
the current value of agent speed

timeToArrival

public double timeToArrival()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the time to arrival to the target location, in model-time units.
If the agent is not moving, returns 0.
Specified by:
timeToArrival in interface ExtAgentWithSpatialMetrics
Returns:
the time to arrival to the target location, or 0

timeToArrival

public double timeToArrival​(TimeUnits units)
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the time to arrival to the target location, in time units.
If the agent is not moving, returns 0.
Specified by:
timeToArrival in interface ExtAgentWithSpatialMetrics
Returns:
the time to arrival to the target location, or 0

updatePosition

public void updatePosition()
Description copied from interface: ExtAgentWithSpatialMetrics
Updates agent coordinates
Specified by:
updatePosition in interface ExtAgentWithSpatialMetrics

getRouteProvider

public IRouteProvider getRouteProvider()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the provider of routes for agent movement
Specified by:
getRouteProvider in interface ExtAgentWithSpatialMetrics
Returns:
the route provider

setRouteProvider

public void setRouteProvider​(IRouteProvider routeProvider)
Description copied from interface: ExtAgentWithSpatialMetrics
Stops agent If it is moving. Sets the route provider for agent movement. Route provider has several implementations: network, straight movement, specific movement in GIS space such as movement by roads.
Specified by:
setRouteProvider in interface ExtAgentWithSpatialMetrics
Parameters:
routeProvider - the route provider

getLevel

public Level getLevel()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the level this agent lives in, actual for agents in continuous space.
Specified by:
getLevel in interface ExtAgentWithSpatialMetrics
Returns:
the level this agent lives in

setLevel

public void setLevel​(Level level)
Description copied from interface: ExtAgentWithSpatialMetrics
Sets this agent to live in the level, actual for agents in continuous space.
Specified by:
setLevel in interface ExtAgentWithSpatialMetrics
Parameters:
level - the level this agent will live in

getNetwork

public INetwork getNetwork()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the network this agent lives in, actual for agents in continuous space.
Specified by:
getNetwork in interface ExtAgentWithSpatialMetrics
Returns:
the network this agent lives in

setNetwork

public void setNetwork​(INetwork network)
Description copied from interface: ExtAgentWithSpatialMetrics
Sets this agent to live in the network, actual for agents in continuous space.
Specified by:
setNetwork in interface ExtAgentWithSpatialMetrics
Parameters:
network - the network this agent will live in

setNetworkInternal

public void setNetworkInternal​(INetwork network,
                               INode node,
                               Position location)
Specified by:
setNetworkInternal in interface ExtAgentWithSpatialMetrics

getNetworkNode

public INode getNetworkNode()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the network node this agent currently is located in, actual for agents in continuous space.
Specified by:
getNetworkNode in interface ExtAgentWithSpatialMetrics
Returns:
the network node this agent currently is located in

setNetworkNode

public void setNetworkNode​(INode node,
                           Point position)
Description copied from interface: ExtAgentWithSpatialMetrics
Sets the current network location for the agent
Specified by:
setNetworkNode in interface ExtAgentWithSpatialMetrics
Parameters:
node - the network node
position - (optional) location within node, may be null

setNetworkNode

public void setNetworkNode​(INode node)
Description copied from interface: ExtAgentWithSpatialMetrics
Sets the current network location for the agent
Specified by:
setNetworkNode in interface ExtAgentWithSpatialMetrics
Parameters:
node - the network node

getSpaceType

public SpaceType getSpaceType()
Description copied from interface: ExtAgentWithSpatialMetrics
Returns the type of space this agent lives in, one of SPACE_CONTINUOUS, SPACE_GIS
Specified by:
getSpaceType in interface ExtAgentWithSpatialMetrics
Returns:
one of SPACE_CONTINUOUS, SPACE_GIS

priority

@AnyLogicInternalAPI
public int priority()
Description copied from interface: AgentExtension
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
This function is used for sorting extensions (in order for the overriding delegation to work)
Specified by:
priority in interface AgentExtension
Overrides:
priority in class AgentExtensionImpl
Returns:
int value, see also P_* constants

onExtensionRemoved

@AnyLogicInternalAPI
public void onExtensionRemoved​(AgentExtension ext)
Description copied from class: AgentExtensionImpl
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Default implementation does nothing
Specified by:
onExtensionRemoved in interface AgentExtension
Overrides:
onExtensionRemoved in class AgentExtensionImpl
Parameters:
ext - the extension which has just been removed
See Also:
AgentExtension.onExtensionRemoved(AgentExtension)

e

@AnyLogicInternalAPI
public final E e()

extClass

@AnyLogicInternalAPI
public abstract java.lang.Class<E> extClass()

isAutomaticVerticalRotation

@AnyLogicInternalAPI
public boolean isAutomaticVerticalRotation()
This functions is valid only for specific set of spaces
See Also:
ExtAgentContinuous.isAutomaticVerticalRotation()
How can we improve this article?