Package com.anylogic.engine
- Field Summary
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- setSpace
- stop
- moveTo
- getSpace
- getAnimationX
- getAnimationY
- getAnimationZ
- getAnimationPosition
- getPresentationScaleOnOwnerSpace
- moveTo
- moveToInTime
- moveToStraight
- moveToStraightInTime
- moveToStraightInTime
- isAnimationVisible_xjal
- moveToInTime
- moveTo
- moveToInTime
- moveToInTime
- moveToInTime
- moveToInTime
- jumpTo
- jumpTo
- jumpTo
- setArrivalCallback
- moveToNearestAgent
- moveToNearestAgent
- getNearestAgent
- agentsInRange
- agentsInRange
- setAutomaticHorizontalRotation
- isAutomaticHorizontalRotation
- getTargetX
- getTargetY
- distanceTo
- distanceTo
- distanceTo
- distanceTo
- distanceTo
- distanceTo
- isMoving
- setVelocity
- getVelocity
- setSpeed
- setSpeed
- getSpeed
- getSpeed
- timeToArrival
- timeToArrival
- updatePosition
- getRouteProvider
- setRouteProvider
- getLevel
- setLevel
- getNetwork
- setNetwork
- setNetworkInternal
- getNetworkNode
- setNetworkNode
- setNetworkNode
- getSpaceType
- priority
- onExtensionRemoved
- e
- extClass
- isAutomaticVerticalRotation
- java.lang.Object
- com.anylogic.engine.AgentExtensionImpl
- com.anylogic.engine.ExtAgentWithSpatialMetricsDelegate<E>
- 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 toExtAgentWithSpatialMetrics
- All Implemented Interfaces:
AgentExtension
,ExtAgentWithSpatialMetrics
,ExtAnimationParams
,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
Constructor | Description |
---|---|
ExtAgentWithSpatialMetricsDelegate |
Modifier and Type | Method | Description |
---|---|---|
<T extends Agent> | agentsInRange |
Returns the unsorted list of agents from the given collection which are within the given
distance from this agent |
<T extends Agent> | agentsInRange |
Returns the unsorted list of agents from the given collection which are within the given
distance from this agent |
double | distanceTo |
Calculates the distance from this agent to a given point in the
projection to the horizontal plane (i.e.
|
double | distanceTo |
Calculates the distance from this agent to a given point in the
projection to the horizontal plane (i.e.
|
double | distanceTo |
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type. |
double | distanceTo |
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type. |
double | distanceTo |
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type. |
double | distanceTo |
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type. |
final E | e() | |
abstract Class<E> | extClass() | |
Position | getAnimationPosition | |
double | getAnimationX() | |
double | getAnimationY() | |
double | getAnimationZ() | |
Level | getLevel() |
Returns the level this agent lives in, actual for agents in continuous space.
|
<T extends Agent> | getNearestAgent |
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 |
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 |
Instantly moves the agent to a given location (without changes to Z-coordinate, if any).
|
void | jumpTo |
Instantly moves the agent to a given network location.
|
void | jumpTo |
Instantly moves the agent to a given location.
|
void | moveTo |
Starts movement in the direction of the given target location.
|
void | moveTo |
Starts movement to the given network node.
"On arrival" code is executed when movement is finished. |
void | moveTo |
Starts movement in the direction of the given target location.
"On arrival" code is executed when movement is finished. |
void | moveToInTime |
Starts movement in the direction of the given target location.
|
void | moveToInTime |
Starts movement in the direction of the given target location.
|
void | moveToInTime |
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 |
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 |
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 |
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 |
Starts movement to the nearest agent from the given collection.
|
void | moveToNearestAgent |
Starts movement to the nearest agent from the given collection.
|
void | moveToStraight |
Starts straight movement in the direction of the given target location.
"On arrival" code is executed when movement is finished. |
void | moveToStraightInTime |
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 |
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 |
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 |
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 |
Tells agent to rotate automatically (in horizontal plane) during movements.
|
void | setLevel |
Sets this agent to live in the level, actual for agents in continuous space.
|
void | setNetwork |
Sets this agent to live in the network, actual for agents in continuous space.
|
void | setNetworkInternal | |
void | setNetworkNode |
Sets the current network location for the agent
|
void | setNetworkNode |
Sets the current network location for the agent
|
void | setRouteProvider |
Stops agent If it is moving.
|
void | setSpace |
Sets the space for agent.
|
void | setSpeed |
Changes speed of the agent (measured in m/s).
If the agent is moving, it continues moving with the new speed. |
void | setSpeed |
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 |
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 |
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
|
error, error, getAgent, getSupportedInterfaces_xjal, next_xjal, onDestroy, setNext_xjal, supportsInterface_xjal
public ExtAgentWithSpatialMetricsDelegate(Agent owner)
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 interfaceExtAnimationParams
- Parameters:
space
- the agent representing space this agent will live in
public void stop()
Description copied from interface:
ExtAgentWithSpatialMetrics
Stops movement, if any.
- Specified by:
stop
in interfaceExtAgentWithSpatialMetrics
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.
"On arrival" code is executed when movement is finished.
- Specified by:
moveTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target location
public Agent getSpace()
Description copied from interface:
ExtAnimationParams
Returns the agent representing space this agent lives in
- Specified by:
getSpace
in interfaceExtAnimationParams
- Returns:
- the agent representing space this agent lives in
public double getAnimationX()
- Specified by:
getAnimationX
in interfaceExtAnimationParams
public double getAnimationY()
- Specified by:
getAnimationY
in interfaceExtAnimationParams
public double getAnimationZ()
- Specified by:
getAnimationZ
in interfaceExtAnimationParams
public Position getAnimationPosition(Position out)
- Specified by:
getAnimationPosition
in interfaceExtAnimationParams
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 interfaceExtAnimationParams
- Returns:
- the scale of presentation animation on owner space
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.
"On arrival" code is executed when movement is finished.
- Specified by:
moveTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
location
- the target location
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
"On arrival" code is executed when movement is finished.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
location
- the target locationtripTime
- the time of the movement trip
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.
"On arrival" code is executed when movement is finished.
- Specified by:
moveToStraight
in interfaceExtAgentWithSpatialMetrics
- Parameters:
location
- the target location
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
"On arrival" code is executed when movement is finished.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
location
- the target locationtripTime
- the time of the movement trip
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
"On arrival" code is executed when movement is finished.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
location
- the target locationtripTime
- the time of the movement tripunits
- the time units
public boolean isAnimationVisible_xjal()
- Specified by:
isAnimationVisible_xjal
in interfaceExtAnimationParams
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
"On arrival" code is executed when movement is finished.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
location
- the target locationtripTime
- the time of the movement tripunits
- the time units
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.
"On arrival" code is executed when movement is finished.
- Specified by:
moveTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
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.
"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 interfaceExtAgentWithSpatialMetrics
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationtripTime
- the time of the movement trip
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.
"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 interfaceExtAgentWithSpatialMetrics
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationtripTime
- the time of the movement tripunits
- the time units
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
"On arrival" code is executed when movement is finished.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
tripTime
- the time of the movement trip
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
"On arrival" code is executed when movement is finished.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
tripTime
- the time of the movement tripunits
- the time units
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
The exact behavior of this method depends on the underlying space type.
Doesn't call "on arrival" code
- Specified by:
jumpTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
x
- the x coordinate of the new locationy
- the y coordinate of the new location
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
Doesn't call "on arrival" code
- Specified by:
jumpTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
location
- the new location
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
Doesn't call "on arrival" code
- Specified by:
jumpTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
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.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
arrivalCallback
- the listener which will be notified about agent's arrival
public void moveToNearestAgent(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 interfaceExtAgentWithSpatialMetrics
- Parameters:
agents
- the collection of agents
public void moveToNearestAgent(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
Changes the speed of the agent in order to reach target in
tripTime
model time units.- Specified by:
moveToNearestAgent
in interfaceExtAgentWithSpatialMetrics
- Parameters:
agents
- the collection of agentstripTime
- the time of the movement trip
public <T extends Agent> T getNearestAgent(Iterable<T> agents)
Description copied from interface:
ExtAgentWithSpatialMetrics
Returns the nearest agent from the given collection
- Specified by:
getNearestAgent
in interfaceExtAgentWithSpatialMetrics
- Parameters:
agents
- the collection of agents- Returns:
- the nearest agent (never
this
one) ornull
if the collection is empty
public <T extends Agent> List<T> agentsInRange(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 interfaceExtAgentWithSpatialMetrics
- Parameters:
agents
- the collection of agents- Returns:
- the list of agents within the given
distance
, unsorted
public <T extends Agent> List<T> agentsInRange(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 interfaceExtAgentWithSpatialMetrics
- Parameters:
agents
- the collection of agents- Returns:
- the list of agents within the given
distance
, unsorted
public void setAutomaticHorizontalRotation(boolean yes)
Description copied from interface:
ExtAgentWithSpatialMetrics
Tells agent to rotate automatically (in horizontal plane) during movements.
- Specified by:
setAutomaticHorizontalRotation
in interfaceExtAgentWithSpatialMetrics
- Parameters:
yes
-true
- agent will be rotated during movement,false
- rotation will not be changed- See Also:
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 interfaceExtAgentWithSpatialMetrics
- Returns:
true
if agent is set to be rotated during movement- See Also:
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.
The exact behavior of this method depends on the underlying space type.
- Specified by:
getTargetX
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the x of the target location if moving, otherwise current x
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.
The exact behavior of this method depends on the underlying space type.
- Specified by:
getTargetY
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the y of the target location if moving, otherwise current y
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.
The exact behavior of this method depends on the underlying space type.
- Specified by:
distanceTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
other
- another agent- Returns:
- the distance to the other agent
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.
The exact behavior of this method depends on the underlying space type.
- Specified by:
distanceTo
in interfaceExtAgentWithSpatialMetrics
- Parameters:
other
- another agentunits
- the units of length- Returns:
- the distance to the other agent
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.
The exact behavior of this method depends on the underlying space type.
- Specified by:
distanceTo
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the distance to the point
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.
The exact behavior of this method depends on the underlying space type.
- Specified by:
distanceTo
in interfaceExtAgentWithSpatialMetrics
units
- the units of length- Returns:
- the distance to the point
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the point- Returns:
- the distance of Agent's projection (on the plane Z=0) to the point (x,y)
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the pointunits
- the units of lengths- Returns:
- the distance of Agent's projection (on the plane Z=0) to the point (x,y)
public boolean isMoving()
Description copied from interface:
ExtAgentWithSpatialMetrics
Tests if the agent is currently moving.
- Specified by:
isMoving
in interfaceExtAgentWithSpatialMetrics
- Returns:
true
if the agent is moving,false
otherwise
@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.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
v
- the new speed
@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.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
- Specified by:
getVelocity
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the current value of agent speed
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.
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 interfaceExtAgentWithSpatialMetrics
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.
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
s
- the new speedunits
- the units of speed
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.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
- Specified by:
getSpeed
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the current value of agent speed, meters per second
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.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
- Specified by:
getSpeed
in interfaceExtAgentWithSpatialMetrics
- Parameters:
units
- the units of speed- Returns:
- the current value of agent speed
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.
If the agent is not moving, returns 0.
- Specified by:
timeToArrival
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the time to arrival to the target location, or 0
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.
If the agent is not moving, returns 0.
- Specified by:
timeToArrival
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the time to arrival to the target location, or 0
public void updatePosition()
Description copied from interface:
ExtAgentWithSpatialMetrics
Updates agent coordinates
- Specified by:
updatePosition
in interfaceExtAgentWithSpatialMetrics
public IRouteProvider getRouteProvider()
Description copied from interface:
ExtAgentWithSpatialMetrics
Returns the provider of routes for agent movement
- Specified by:
getRouteProvider
in interfaceExtAgentWithSpatialMetrics
- Returns:
- the route provider
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
routeProvider
- the route provider
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 interfaceExtAgentWithSpatialMetrics
- Returns:
- the level this agent lives in
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
level
- the level this agent will live in
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 interfaceExtAgentWithSpatialMetrics
- Returns:
- the network this agent lives in
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 interfaceExtAgentWithSpatialMetrics
- Parameters:
network
- the network this agent will live in
public void setNetworkInternal(INetwork network, INode node, Position location)
- Specified by:
setNetworkInternal
in interfaceExtAgentWithSpatialMetrics
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 interfaceExtAgentWithSpatialMetrics
- Returns:
- the network node this agent currently is located in
public void setNetworkNode(INode node, Point position)
Description copied from interface:
ExtAgentWithSpatialMetrics
Sets the current network location for the agent
- Specified by:
setNetworkNode
in interfaceExtAgentWithSpatialMetrics
- Parameters:
node
- the network nodeposition
- (optional) location within node, may benull
public void setNetworkNode(INode node)
Description copied from interface:
ExtAgentWithSpatialMetrics
Sets the current network location for the agent
- Specified by:
setNetworkNode
in interfaceExtAgentWithSpatialMetrics
- Parameters:
node
- the network node
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 interfaceExtAgentWithSpatialMetrics
- Returns:
- one of
SPACE_CONTINUOUS, SPACE_GIS
@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)
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 interfaceAgentExtension
- Overrides:
priority
in classAgentExtensionImpl
- Returns:
- int value, see also
P_*
constants
@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
it may be removed/renamed in future.
Default implementation does nothing
- Specified by:
onExtensionRemoved
in interfaceAgentExtension
- Overrides:
onExtensionRemoved
in classAgentExtensionImpl
- Parameters:
ext
- the extension which has just been removed- See Also:
@AnyLogicInternalAPI public final E e()
@AnyLogicInternalAPI public abstract Class<E> extClass()
@AnyLogicInternalAPI public boolean isAutomaticVerticalRotation()
This functions is valid only for specific set of spaces