|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.Presentable
com.xj.anylogic.engine.Utilities
com.xj.anylogic.engine.ActiveObject
com.xj.anylogic.engine.Agent
com.xj.anylogic.engine.AgentContinuous
public abstract class AgentContinuous
Base class for agents with continuous space. Use one of subclasses:
| Field Summary |
|---|
| Fields inherited from class com.xj.anylogic.engine.Agent |
|---|
ALL, ALL_CONNECTED, ALL_NEIGHBORS, EAST, NORTH, NORTHEAST, NORTHWEST, RANDOM, RANDOM_CONNECTED, RANDOM_NEIGHBOR, SOUTH, SOUTHEAST, SOUTHWEST, WEST |
| Fields inherited from class com.xj.anylogic.engine.ActiveObject |
|---|
DRAW_PARAMETER_DYNAMIC, DRAW_SD_ARRAY, DRAW_SD_CONSTANT, DRAW_SD_EXTERNAL, DRAW_SD_LINK_DELAY, DRAW_SD_LINK_INITIAL, DRAW_SD_NEGATIVE, DRAW_SD_NO_SOURCE, DRAW_SD_NO_TARGET, DRAW_SD_PUBLIC_ONLY, DRAW_SD_SHADOW, DRAW_SD_ZERO, EVENT_TIMEOUT_MODE_CYCLIC, EVENT_TIMEOUT_MODE_ONCE, EVENT_TIMEOUT_MODE_USER |
| Fields inherited from class com.xj.anylogic.engine.Utilities |
|---|
AM, APRIL, AUGUST, DAY, DECEMBER, FEBRUARY, FRIDAY, HOUR, infinity, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK, YEAR |
| Method Summary | |
|---|---|
abstract double |
distanceTo(Agent other)
Calculates the distance from this agent to another one in continuous 2D space or GIS space. |
AgentContinuous |
getConnectedAgent(int index)
Returns the connected agent with a given index. |
java.util.LinkedList<? extends AgentContinuous> |
getConnections()
Returns a collection of agents connected to this agent (bi-directionally), or null if there have not been any connections yet. |
EnvironmentContinuous<?> |
getEnvironment()
Returns the environment where this agent belongs to. |
AgentContinuous |
getNearestAgent(java.lang.Iterable<? extends AgentContinuous> agents)
Returns the nearest agent from the given collection |
double |
getRotation()
Returns the current rotation angle (in radians) of the agent in continuous 2D space or GIS space. |
double |
getShapeRotation(int id,
int index)
Should be overridden to return the rotation angle of a non-persistent shape in radians. |
double |
getTargetX()
Returns the x of the target location if moving, otherwise current x in continuous 2D space or GIS space. |
double |
getTargetY()
Returns the y of the target location if moving, otherwise current y in continuous 2D space or GIS space. |
double |
getVelocity()
Returns the current value of the agent velocity in continuous space. |
double |
getX()
Returns the current (up-to-date) x coordinate of the agent in continuous space. |
double |
getY()
Returns the current (up-to-date) y coordinate of the agent in continuous space. |
boolean |
isMoving()
Tests if the agent is currently moving in continuous 2D space or GIS space. |
boolean |
isRotationFrozen()
Returns true if rotation angle(s) of this Agent in
continuous space is frozen,
i.e. |
void |
moveToNearestAgent(java.lang.Iterable<? extends AgentContinuous> agents)
Starts movement to the nearest agent from the given collection. |
void |
onArrival()
A callback that is called when the agent arrives to the target location after movement initiated by moveTo() in continuous 2D space. |
void |
onDestroy()
This method must be called when the agent is destroyed. |
void |
setVelocity(double v)
Changes velocity of the agent in continuous space (measured in pixels per model-time-unit, and in GIS-based environments - in m/s). |
void |
stop()
Stops movement in continuous 2D, 3D or GIS space, if any. |
double |
timeToArrival()
Returns the time to arrival to the target location in continuous 2D space or GIS space, in model-time units. |
| Methods inherited from class com.xj.anylogic.engine.Agent |
|---|
agentInfo, deliver, disconnectFrom, disconnectFromAll, getConnectionsNumber, getShapeX, getShapeY, isConnectedTo, onBeforeStep, onStep, receive, restoreConnections_xjal, send, setEnvironment |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public void onDestroy()
onDestroy in class Agentpublic double getX()
public double getY()
public abstract double distanceTo(Agent other)
other - another agent
public void stop()
public void moveToNearestAgent(java.lang.Iterable<? extends AgentContinuous> agents)
agents - the collection of agentspublic final AgentContinuous getNearestAgent(java.lang.Iterable<? extends AgentContinuous> agents)
agents - the collection of agents
this one)
or null if the collection is emptypublic boolean isMoving()
public void setVelocity(double v)
v - the new velocitypublic double getVelocity()
public double getRotation()
isRotationFrozen(), setRotation(double, boolean)),
the rotation changes each time the agent starts moving and also changes
multiple times during movement in GIS space.
public boolean isRotationFrozen()
true if rotation angle(s) of this Agent in
continuous space is frozen,
i.e. moveTo(double, double) calls cannot change rotation,
which is currently set
true if rotation angle(s) of this Agent is frozen,
i.e. moveTo(double, double) calls cannot change rotation,
which is currently setsetRotation(double, boolean)public double getTargetX()
public double getTargetY()
public final double timeToArrival()
public void onArrival()
public EnvironmentContinuous<?> getEnvironment()
Agent
getEnvironment in class Agentpublic AgentContinuous getConnectedAgent(int index)
Agent
getConnectedAgent in class Agentindex - the index of connection
public java.util.LinkedList<? extends AgentContinuous> getConnections()
getConnections in class Agent
public double getShapeRotation(int id,
int index)
Presentable
getShapeRotation in class Presentableid - the shape idindex - index of the shape (for replicated shapes)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||