Package com.anylogic.engine
- Field Summary
- Fields inherited from class com.anylogic.engine.Utilities
- Fields inherited from class com.anylogic.engine.Presentable
- Fields inherited from interface com.anylogic.engine.AgentConstants
- Fields inherited from interface com.anylogic.engine.EnvironmentConstants
- Fields inherited from interface com.anylogic.engine.UtilitiesMath
- Fields inherited from interface com.anylogic.engine.UtilitiesRandom
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- setEngine
- getEngine
- getId
- setId
- getAgentTypeId
- logToDB
- logToDBEnterState
- logToDBExitState
- getExperimentHost
- getName
- getFullName
- toString
- error
- errorInModel
- warning
- warning
- getOwner
- getScale
- toLengthUnits
- toPixels
- getNetworks
- getLevels
- getRailwayNetworks
- getRoadNetworks
- getConveyorNetworks
- getOwnerShape
- getEmbeddedObjects
- isReplicated
- getIndex
- getReplicatedCollection
- getReplicatedList
- getPopulation
- goToPopulation
- onOwnerChanged_xjal
- instantiateBaseStructure_xjal
- deleteSelf
- removeFromFlowchart
- onBeforeCreate
- onCreate
- onStartup
- onChange
- nothingChanged
- getDynamicEvents
- isPublicPresentationDefined
- isEmbeddedAgentPresentationVisible
- getNameOf
- getModeOf
- getFirstOccurrenceTime
- evaluateTimeoutOf
- executeActionOf
- getNameOf
- evaluateRateOf
- executeActionOf
- getNameOf
- testConditionOf
- executeActionOf
- isLoggingToDB
- isLoggingToDB
- inState
- getNameOf
- getIdOf
- executeActionOf
- getNameOfState
- stateContainsState
- getContainerStateOf
- getNameOf
- evaluateTimeoutOf
- testGuardOf
- executeActionOf
- getStatechartOf
- getNameOf
- evaluateRateOf
- testGuardOf
- executeActionOf
- getStatechartOf
- getNameOf
- testConditionOf
- testGuardOf
- executeActionOf
- getStatechartOf
- getNameOf
- testMessageOf
- testGuardOf
- executeActionOf
- executeActionOf
- getStatechartOf
- getNameOf
- executeOnSendActionOf
- executeOnReceiveActionOf
- getNameOf
- getNameOf
- getAnimationSettingsOf
- getAnimationSettingsOf
- getCameras3D
- drawLinksToAgents
- _initGetEngine_xjal
- createAndStart
- getRootAgent
- getDefaultPopulation
- setParametersToDefaultValues
- markParametersAreSet
- setParameter
- getParameter
- getParameterNames
- create
- createAsEmbedded
- doAfterCreate
- doCreate
- start
- startAsEmbedded
- doStart
- stopSimulation
- finishSimulation
- pauseSimulation
- runSimulation
- setDestroyed
- onDestroy
- onEngineFinished
- doFinish
- getIntegrationManager_xjal
- getDifferentialFlatEquationsCount_xjal
- getRuntimeAlgebraicFlatEquationsCount_xjal
- getRuntimeFormulaFlatEquationsCount_xjal
- getInitialAlgebraicFlatEquationsCount_xjal
- getInitialFormulaFlatEquationsCount_xjal
- getPhaseVector_xjal
- putPhaseVector_xjal
- getRightPart_xjal
- formulasExecute_xjal
- getPhaseVectorForInitialConditions_xjal
- putPhaseVectorForInitialConditions_xjal
- getRightPartForInitialConditions_xjal
- assignInitialConditions_xjal
- setupInitialConditions_xjal
- restoreCollection_xjal
- restoreOwner
- tryExt
- ext
- addExt_xjal
- setupExt_xjal
- removeExt_xjal
- isAgent
- isEnvironment
- setAgentSpaceType
- getAgentSpaceType
- getEnvironmentSpaceType
- onBeforeStepEnvironment
- onAfterStepEnvironment
- agents
- randomAgentInside
- randomAgentInside
- disableSteps
- enableSteps
- areStepsEnabled
- deliverToAllAgentsInside
- deliverToRandomAgentInside
- setNetworkUserDefined
- setNetworkRandom
- setNetworkRingLattice
- setNetworkSmallWorld
- setNetworkScaleFree
- getNetworkType
- getNetworkConnectionsPerAgent
- getNetworkNeighborLinkProbability
- getNetworkScaleFreeM
- applyNetwork
- applyNetwork
- spaceWidth
- spaceHeight
- spaceCellWidth
- spaceCellHeight
- setNetworkAllInRange
- getNetworkConnectionRange
- setLayoutType
- getLayoutType
- applyLayout
- setupSpace
- setupSpace
- spaceZHeight
- randomPointOfSpace
- setupSpace
- spaceRows
- spaceColumns
- randomEmptyCell
- getAgentAtCell
- setupSpace
- getGISMap
- onBeforeStep
- onStep
- onReceive
- onArrival
- setEnvironment
- getEnvironment
- getConnections
- restoreConnections_xjal
- getConnectionsNumber
- getConnectedAgent
- getRandomConnectedAgent
- connectTo
- isConnectedTo
- disconnectFrom
- disconnectFromAll
- send
- sendToAll
- sendToRandom
- sendToAllConnected
- sendToRandomConnected
- sendToAllNeighbors
- sendToRandomNeighbor
- send
- deliver
- deliverToAllConnected
- deliverToRandomConnected
- deliverToAllNeighbors
- deliverToRandomNeighbor
- deliver
- receive
- agentInfo
- setSpace
- getSpace
- getPresentationScaleOnOwnerSpace
- getX
- getY
- getXYZ
- getXYZ
- getPosition
- getPosition
- getRotation
- setRotation
- setAutomaticHorizontalRotation
- isAutomaticHorizontalRotation
- getNearestAgent
- getNearestAgentByRoute
- moveToNearestAgent
- moveToNearestAgent
- agentsInRange
- agentsInRange
- agentsInRange
- agentsInRange
- setXY
- setLatLon
- isSpacePositionSet_xjal
- getTargetX
- getTargetY
- distanceTo
- distanceTo
- distanceByRoute
- distanceTo
- distanceTo
- jumpTo
- moveToStraight
- moveToStraight
- moveToStraight
- moveToStraightInTime
- moveToStraightInTime
- moveTo
- moveToInTime
- moveToInTime
- isMoving
- stop
- setVelocity
- getVelocity
- setSpeed
- setSpeed
- getSpeed
- getSpeed
- timeToArrival
- timeToArrival
- getLevel
- setLevel
- getNetwork
- setNetwork
- getNetworkNode
- setNetworkNode
- setNetworkNode
- setNetworkNode
- getZ
- getTargetZ
- setVerticalRotation
- getVerticalRotation
- setAutomaticVerticalRotation
- isAutomaticVerticalRotation
- setXYZ
- setPosition
- setLocation
- setLocation
- setLocationRandomInside
- setLocation
- setXYZ
- setLocation
- jumpTo
- jumpTo
- jumpTo
- jumpTo
- jumpTo
- moveTo
- moveTo
- moveToInTime
- moveToInTime
- moveTo
- moveToInTime
- moveToInTime
- moveTo
- moveTo
- moveToInTime
- moveToInTime
- moveToInTime
- moveToInTime
- moveTo
- moveToInTime
- moveToInTime
- moveToStraight
- moveToStraightInTime
- moveToStraightInTime
- moveTo
- moveToInTime
- moveToInTime
- moveTo
- moveToInTime
- moveToInTime
- moveTo
- moveToInTime
- moveToInTime
- moveTo
- moveToInTime
- moveToInTime
- getRouteProvider
- setRouteProvider
- distanceTo
- distanceTo
- distanceTo
- distanceTo
- getLat
- getLon
- getLatitude
- getLongitude
- getTargetLon
- getTargetLat
- getGISHeading
- getR
- getC
- setCell
- jumpToCell
- moveToNextCell
- isNextCellInsideSpace
- swapWithCell
- swapWithNextCell
- swapWithAgent
- jumpToRandomEmptyCell
- getAgentNextToMe
- getNeighbors
- onEnterFlowchartBlock
- onExitFlowchartBlock
- onSeizeResource
- onReleaseResource
- highlight
- getFlowchartEntryTime
- addAgentToContents
- addEntityToContents
- removeAgentFromContents
- removeEntityFromContents
- getLength
- getLength
- setLength
- setLength
- getWidth
- getWidth
- setWidth
- setWidth
- getHeight
- getHeight
- setHeight
- setHeight
- setDimensions
- setDimensions
- contents
- resourceUnits
- resourceUnitsOfSeize
- resourceUnitsOfPool
- resourceUnitOfPool
- currentBlock
- getBlockEnterTime
- setColor
- getColor
- getPresentationShape
- getLinkToAgentStandard_xjal
- java.lang.Object
- com.anylogic.engine.Presentable
- com.anylogic.engine.Utilities
- com.anylogic.engine.Agent
- All Implemented Interfaces:
AgentConstants
,EnvironmentConstants
,IMaintenanceable
,com.anylogic.engine.internal.Child
,UtilitiesMath
,UtilitiesRandom
,UtilitiesString
,Serializable
- Direct Known Subclasses:
FlowchartBlock
public class Agent extends Utilities implements com.anylogic.engine.internal.Child, IMaintenanceable
This is a base class for all agent classes created by the user.
Agent is the main building block of AnyLogic models; it can have
parameters, variables, ports, events, statecharts and embedded agents
and/or agent populations.
Agent is the unit of dynamic creation of destruction.
Agent may dynamically obtain extensions (which will increase memory footprint of agent), see
Agent may dynamically obtain extensions (which will increase memory footprint of agent), see
ext(Class)
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Field | Description |
---|---|---|
static final Object | _ARRIVAL_message_xjal |
This variable shouldn't be accessed by user:
it is used internally by AnyLogic
and may be renamed/removed in future
|
AM, APRIL, AUGUST, DECEMBER, FEBRUARY, FRIDAY, JANUARY, JULY, JUNE, LENGTH_UNIT_CENTIMETER, LENGTH_UNIT_FOOT, LENGTH_UNIT_INCH, LENGTH_UNIT_KILOMETER, LENGTH_UNIT_METER, LENGTH_UNIT_MILE, MARCH, MAY, MONDAY, NOVEMBER, OCTOBER, PM, SATURDAY, SEPTEMBER, SUNDAY, THURSDAY, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_MONTH, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIME_UNIT_YEAR, TUESDAY, UNDECIMBER, WEDNESDAY
ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ARROW_FILLED, ARROW_NONE, ARROW_THIN, CAD_ANTIALIASING, CAD_INVERTED, LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_SOLID, SHAPE_DRAW_2D, SHAPE_DRAW_2D3D, SHAPE_DRAW_3D
AGENT_ORIENTATION_FRONT, AGENT_ORIENTATION_LEFT, AGENT_ORIENTATION_REAR, AGENT_ORIENTATION_RIGHT, ALL, ALL_CONNECTED, ALL_NEIGHBORS, AREA_ACCESS_RESTRICTION_BY_CAPACITY, AREA_ACCESS_RESTRICTION_BY_CONDITION, AREA_ACCESS_RESTRICTION_BY_SCHEDULE, AREA_ACCESS_RESTRICTION_BY_THROUGHPUT, AREA_ACCESS_RESTRICTION_MANUAL, CENTIMETER, CONVEYOR_BACKWARD, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_CENTER, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_NEAR_CONVEYOR, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_RANDOM, CONVEYOR_FORWARD, CONVEYOR_SIMPLE_STATION_DELAY_TYPE_MANUAL, CONVEYOR_SIMPLE_STATION_DELAY_TYPE_TIMEOUT, CONVEYOR_TYPE_BELT, CONVEYOR_TYPE_CELL, CONVEYOR_TYPE_ROLLER, CUBIC_METER, CUBIC_METER_PER_SECOND, CUSTOM_COLOR_SCHEME, DAY, DEG_PER_SECOND, DEGREE, DENSITY_VALUE_MAX, DENSITY_VALUE_MEAN, EAST, ELEVATOR_DIRECTION_DOWN, ELEVATOR_DIRECTION_NONE, ELEVATOR_DIRECTION_UP, ELEVATOR_DOOR_FRONT, ELEVATOR_DOOR_REAR, ELEVATOR_DOORS_FRONT, ELEVATOR_DOORS_FRONT_REAR, ELEVATOR_DOORS_FRONT_REAR_XJAL, ELEVATOR_DOORS_FRONT_XJAL, ELEVATOR_MOVEMENT_BY_SPEED, ELEVATOR_MOVEMENT_BY_TIME_PER_LEVEL, ELEVATOR_STATE_FAILED, ELEVATOR_STATE_IDLE, ELEVATOR_STATE_LOADING, ELEVATOR_STATE_MOVING, ESCALATOR_STAY_ALL, ESCALATOR_WALK_ALL, ESCALATOR_WALK_ON_LEFT_SIDE, ESCALATOR_WALK_ON_RIGHT_SIDE, EVENT_TIMEOUT_MODE_CYCLIC, EVENT_TIMEOUT_MODE_ONCE, EVENT_TIMEOUT_MODE_USER, EXCEEDED_QUEUE_CROWD_ROUND_AT_THE_END, EXCEEDED_QUEUE_EXTEND_TO_THE_FREE_SPACE, EXT_AGENT_CONTINUOUS, EXT_AGENT_DISCRETE, EXT_AGENT_GIS, EXT_AGENT_INTERACTIVE, EXT_AGENT_NETWORK, EXT_ENTITY, EXT_ENVIRONMENT_CONTINUOUS, EXT_ENVIRONMENT_DISCRETE, EXT_ENVIRONMENT_GIS, EXT_ENVIRONMENT_INTERACTIVE, EXT_SPACE, FLOW_STATISTICS_BOTH, FLOW_STATISTICS_LEFT, FLOW_STATISTICS_RIGHT, FOOT, FPM, FPS, FPS_SQ, HOUR, INCH, JIB_CRANE_CAT_HEAD, JIB_CRANE_FLAT_TOP, JIB_CRANE_INDUSTRIAL, JIB_CRANE_MOVEMENT_CONCURRENT, JIB_CRANE_MOVEMENT_STEP_BY_STEP, KILOGRAM, KILOGRAM_PER_SECOND, KILOMETER, KN, KPH, LIFT_PLATFORM_FLAT, LIFT_PLATFORM_ROLLER, LIFT_SELECTION_MODE_COMPARISON, LIFT_SELECTION_MODE_FIFO, LIFT_SELECTION_MODE_PRIORITY, LINEAR_COLOR_SCHEME, LITER, LITER_PER_SECOND, LOGARITHMIC_COLOR_SCHEME, METER, MILE, MILLIMETER, MILLISECOND, MINUTE, MONTH, MPH, MPS, MPS_SQ, NAUTICAL_MILE, NORTH, NORTHEAST, NORTHWEST, OBJECT_3D_INTERNAL_LIGHTING_GLOBAL, OBJECT_3D_INTERNAL_LIGHTING_INSIDE, OBJECT_3D_INTERNAL_LIGHTING_OFF, OBJECT_3D_XYZ_AXIS_ORDER, OBJECT_3D_YZX_AXIS_ORDER, OBJECT_3D_ZXY_AXIS_ORDER, OIL_BARREL, OIL_BARREL_PER_SECOND, OVERHEAD_CRANE_BRIDGE, OVERHEAD_CRANE_GANTRY, OVERHEAD_CRANE_GIRDER_DOUBLE_TIE, OVERHEAD_CRANE_GIRDER_SINGLE_FLAT, OVERHEAD_CRANE_MOVEMENT_CONCURRENT, OVERHEAD_CRANE_MOVEMENT_INDEPENDENT_HOIST, OVERHEAD_CRANE_MOVEMENT_STEP_BY_STEP, PALLET_RACK_LEFT_TO_RIGHT, PALLET_RACK_NO_DIRECTION, PALLET_RACK_RIGHT_TO_LEFT, PALLET_RACK_SINGLE_AISLE_LEFT, PALLET_RACK_SINGLE_AISLE_RIGHT, PALLET_RACK_TWO_AISLES, PALLET_RACK_TWO_PALLET_RACKS, PARKING_LOT_PARALLEL, PARKING_LOT_PERPENDICULAR, PATH_CONVEYOR, PATH_DASHEDLINE, PATH_LINE, PATH_RAILROAD, PATH_ROAD, PEDESTRIAN_MAP_TYPE, PER_DAY, PER_HOUR, PER_MILLISECOND, PER_MINUTE, PER_MONTH, PER_SECOND, PER_WEEK, PER_YEAR, POSITION_CHOICE_ARRANGED, POSITION_CHOICE_BY_ATTRACTORS, POSITION_CHOICE_RANDOM, RACK_PLACEMENT_BACK_TO_BACK, RACK_PLACEMENT_STAND_ALONE, RACK_TYPE_DRIVE_IN, RACK_TYPE_FIFO_FLOW, RACK_TYPE_LIFO_FLOW, RACK_TYPE_SELECTIVE, RAD_PER_SECOND, RADIAN, RAILWAY_SWITCH_ALL_TO_ALL, RAILWAY_SWITCH_DOUBLE_SLIP, RAILWAY_SWITCH_SINGLE_SLIP, RANDOM, RANDOM_CONNECTED, RANDOM_NEIGHBOR, ROAD_LEFT_HAND, ROAD_LINE_DOUBLE, ROAD_LINE_DOUBLE_DASHED, ROAD_LINE_SINGLE, ROAD_LINE_SINGLE_DASHED, ROAD_RIGHT_HAND, RPM, SECOND, SERVICE_GROUP_BEHAVIOR_DEPENDS_ON_INCOMING_GROUP, SERVICE_GROUP_BEHAVIOR_SAME_FOR_ALL_GROUPS, SERVICE_GROUP_INDIVIDUAL_SERVING, SERVICE_GROUP_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_AREA, SERVICE_GROUP_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_QUEUE, SERVICE_QUEUE_CLOSEST_NON_EMPTY, SERVICE_QUEUE_CLOSEST_STRICT, SERVICE_QUEUE_CUSTOM, SERVICE_QUEUE_LONGEST, SERVICE_QUEUE_NEXT_ROUND_ROBIN, SERVICE_QUEUE_PRIORITY, SERVICE_TYPE_LINEAR, SERVICE_TYPE_POINT, SIGNAL_GREEN, SIGNAL_NONE, SIGNAL_RED, SIGNAL_YELLOW, SIMPLE_STATION_LOADING_MODE_AFTER_UNLOADING, SIMPLE_STATION_LOADING_MODE_SIMULTANEOUS_WITH_UNLOADING, SIMPLE_STATION_PROCESSING_WHEN_AGENT_ENTERS, SIMPLE_STATION_PROCESSING_WHEN_CAPACITY_FULL, SOUTH, SOUTHEAST, SOUTHWEST, SPACE_CONTINUOUS, SPACE_CONTINUOUS_2D, SPACE_DISCRETE, SPACE_DISCRETE_2D, SPACE_GIS, SPACE_UNDEFINED, SQ_CENTIMETER, SQ_FOOT, SQ_INCH, SQ_KILOMETER, SQ_METER, SQ_MILE, SQ_MILLIMETER, SQ_NAUTICAL_MILE, SQ_YARD, TON, TON_PER_SECOND, TRANSFER_MODE_AUTOMATIC, TRANSFER_MODE_MANUAL, TRANSPORTER_MAP_TYPE, TURN, TURN_STATION_MODE_ANGLE, TURN_STATION_MODE_ORIENTATION, WALL_FILL_HATCHING, WALL_FILL_NONE, WALL_FILL_SOLID, WEEK, WEST, WINDOW_3D_NAVIGATION_FULL, WINDOW_3D_NAVIGATION_LIMITED_TO_Z_ABOVE_ZERO, WINDOW_3D_NAVIGATION_NONE, WINDOW_3D_NAVIGATION_ROTATION_ONLY, YARD, YEAR
LAYOUT_ARRANGED, LAYOUT_RANDOM, LAYOUT_RING, LAYOUT_SPRING_MASS, LAYOUT_USER_DEFINED, NEIGHBORHOOD_EUCLIDEAN, NEIGHBORHOOD_MOORE, NETWORK_ALL_IN_RANGE, NETWORK_RANDOM, NETWORK_RING_LATTICE, NETWORK_SCALE_FREE, NETWORK_SMALL_WORLD, NETWORK_USER_DEFINED
Constructor | Description |
---|---|
Agent() |
Create constructor.
This is a way for e.g. |
Agent |
Constructs the agent, sets up its owner and list (if replicated).
|
Modifier and Type | Method | Description |
---|---|---|
static Engine | _initGetEngine_xjal |
This method shouldn't be called by user.
It is public due to technical reasons.
|
void | addAgentToContents |
Adds a given agent to the contents of this agent.
|
void | addEntityToContents |
Deprecated.
|
void | addExt_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future |
String | agentInfo() | |
Collection<Agent> | agents() |
Returns the collection of all agents registered with this environment.
|
List<? extends Agent> | agentsInRange |
Returns the unsorted list of agents (from the population
this agent lives in), which are within the given
distance from this agent |
List<? extends Agent> | agentsInRange |
Returns the unsorted list of agents (from the population
this agent lives in), which are within the given
distance from this agent |
final <T extends Agent> | agentsInRange |
Returns the unsorted list of agents from the given collection which are within the given
distance from this agent |
final <T extends Agent> | agentsInRange |
Returns the unsorted list of agents from the given collection which are within the given
distance from this agent |
void | applyLayout() |
Rearranges agents in this environment according to the selected layout type.
|
void | applyNetwork() |
Discards all existing connections and establishes new connection
network according to the current network settings.
|
void | applyNetwork |
Discards all existing connections and establishes new connection
network according to the current network settings,
using the specified random number generator, if required by network type.
|
boolean | areStepsEnabled() |
Tests if the time steps are enabled.
|
void | assignInitialConditions_xjal() |
This method shouldn't be normally called by user.
This function assigns initial conditions for stocks and for flow aux variables |
boolean | connectTo |
Creates a bi-directional connection between this agent and a given
other agent.
|
<T extends Agent> | contents() | |
final void | create() |
Creates the agent embedded objects; also calls user's
onBeforeCreate() at the beginning and onCreate() at the end. |
void | createAndStart |
Assigns the owner of the agent to the top-level agent of the model, creates the internal
structure of the agent (internally embedded agents, statecharts etc.)
and starts it (thus its statechart and events start living).
|
final void | createAsEmbedded() |
Internal method to be called for embedded agents inside
doCreate() of an upper-level agent. |
FlowchartBlock | currentBlock() |
Returns the current flowchart block this agent
is being processed in.
|
void | deleteSelf() |
Removes this agent from the agent population (replicated agent list) it belongs to.
|
void | deliver |
Delivers a message to a given agent immediately during this method call.
|
void | deliver |
Delivers a message to an agent or a group of agents, as specified by the
mode parameter immediately during this method call.
|
void | deliverToAllAgentsInside |
Immediately delivers a message to all agents in the environment.
|
void | deliverToAllConnected |
Delivers a message to all connected agents.
|
void | deliverToAllNeighbors |
Delivers a message to all neighbors.
|
void | deliverToRandomAgentInside |
Immediately delivers a message to a random agent in the environment,
if there are any agents.
|
void | deliverToRandomConnected |
Delivers a message to a randomly chosen connected agent.
|
void | deliverToRandomNeighbor |
Delivers a message to a randomly chosen neighbor.
|
void | disableSteps() |
Disables time steps.
|
boolean | disconnectFrom |
Disconnects this agent from another given agent.
|
void | disconnectFromAll() |
Disconnects the agent from all other agents.
|
double | distanceByRoute |
Calculates the distance from this agent to another one by route.
Only for agents in GIS environment. |
double | distanceTo |
Calculates the distance from this agent to a given point in continuous 3D or GIS space.
|
double | distanceTo |
Calculates the distance from this agent to a given point in continuous space.
|
double | distanceTo |
Calculates the distance from this agent to a given point in continuous space.
|
double | distanceTo |
Calculates the distance from this agent to a given point in continuous 3D or GIS space.
|
double | distanceTo |
Calculates the distance from this agent to another one in continuous 3D space or GIS space.
In case of GIS environment returns distance measured in meters |
double | distanceTo |
Calculates the distance from this agent to another one in continuous 3D space or GIS space.
In case of GIS environment returns distance measured in meters |
double | distanceTo |
Calculates the distance from this agent to a given point.
|
double | distanceTo |
Calculates the distance from this agent to a given point.
|
void | doAfterCreate() |
Internal callback to perform additional "after all agents created" actions.
|
void | doCreate() |
Creates the agent embedded objects.
If there are any embedded objects, this method should be implemented in subclass to instantiate them, setup their parameters and call agent. method on each agent . |
void | doFinish() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons. |
void | doStart() |
Starts activities (e.g.
|
void | drawLinksToAgents |
This method automatically generated by AnyLogic.
|
void | enableSteps |
Enables discrete time steps with a given duration.
|
RuntimeException | error |
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
|
RuntimeException | errorInModel |
Signals an model logic error during the model run by throwing a ModelException
with errorText preceded by the agent full name.
This method differs from error() in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. |
double | evaluateRateOf |
Evaluates the rate expression of a rate event.
Must be implemented in a subclass if there are any rate events. |
double | evaluateRateOf |
Evaluates the rate expression of a rate transition.
Must be implemented in a subclass if there are any rate transitions. |
double | evaluateTimeoutOf |
Evaluates timeout expression of a timeout event.
Must be implemented in a subclass if there are any timeout events. |
double | evaluateTimeoutOf |
Evaluates timeout expression of a timeout transition.
Must be implemented in a subclass if there are any timeout transitions. |
void | executeActionOf |
Executes action of a condition event.
Implementation in a subclass can be skipped if the action(s) are empty. |
void | executeActionOf |
Executes action of a rate event.
Implementation in a subclass can be skipped if the action(s) are empty. |
void | executeActionOf |
Executes action of a timeout event.
Implementation in a subclass can be skipped if the action(s) are empty. |
void | executeActionOf |
Executes startup action of a statechart: calls actions of the statechart
entry point, entry action of initial states, starts the corresponding transitions,
etc., and sets up the initially active simple state.
Must be implemented in a subclass if there are any statecharts. |
void | executeActionOf |
Executes action of a condition transition.
Implementation in a subclass can be skipped if the action(s) are empty. |
void | executeActionOf |
Executes action of a message transition for int message type - depends on the message.
Implementation in a subclass can be skipped if the action(s) are empty. |
void | executeActionOf |
Executes action of a message transition for Object message type - depends on the message.
Implementation in a subclass can be skipped if the action(s) are empty. |
void | executeActionOf |
Executes action of a rate transition.
Implementation in a subclass can be skipped if the action(s) are empty. |
void | executeActionOf |
Executes action of a timeout transition.
Implementation in a subclass can be skipped if the action(s) are empty. |
boolean | executeOnReceiveActionOf |
Executes action code associated with a message being received at a port.
|
boolean | executeOnSendActionOf |
Executes action associated with a message being sent via a port.
|
final <T extends AgentExtension> | ext |
Returns an extension of given type.
|
boolean | finishSimulation() |
Engine command applicable only in RUNNING or PAUSED state (in other states
does nothing and returns
false ). |
void | formulasExecute_xjal() |
This method shouldn't be normally called by user.
Executes formulas defined in this agent. |
Agent | getAgentAtCell |
Returns the agent located in the cell with a given row and column, or null.
|
Agent | getAgentNextToMe |
Returns the agent next to this agent in a given direction, if any.
|
SpaceType | getAgentSpaceType() |
Returns agent space type, if this is an agent and it has spatial information.
|
int | getAgentTypeId() |
Returns the unique identifier of agent's type
|
AgentAnimationSettings | getAnimationSettingsOf |
Returns the animation settings of a simple (not replicated) embedded object.
Must be implemented in a subclass if there are any embedded objects. |
AgentAnimationSettings | getAnimationSettingsOf |
Returns the animation settings of a replicated embedded object.
Must be implemented in a subclass if there are any replicated embedded objects. |
double | getBlockEnterTime() |
Returns the time this agent entered its current flowchart block.
|
int | getC() |
Returns the column of the agent's cell.
|
int | getCameras3D |
Adds all
Camera3D of this agent to the given
map output , if it is not null .Default implementation does nothing and returns 0 . |
Color | getColor() |
Returns the color of the item's default animation shape.
|
Agent | getConnectedAgent |
Returns the connected agent with a given index.
|
<T extends Agent> | getConnections() |
Returns a collection of agents connected to this agent (bi-directionally),
or empty collection if there have not been any connections yet.
|
int | getConnectionsNumber() |
Returns the number of agents connected to this agent.
|
<T extends Enum<T> & IStatechartState<?, | getContainerStateOf |
Deprecated.
|
ConveyorNetwork[] | getConveyorNetworks() |
Returns array of conveyor networks located in this agent, or empty array
|
AgentList<Agent> | getDefaultPopulation() |
Returns the default population (contained in top-level agent) or
null if root couldn't be found |
int | getDifferentialFlatEquationsCount_xjal() |
This method shouldn't be normally called by user.
|
Set<DynamicEvent> | getDynamicEvents() |
Returns the set of all currently existing dynamic events of this agent.
|
List<Object> | getEmbeddedObjects() |
Creates and returns a list of embedded objects if there are any, null
if there are none.
|
Engine | getEngine() |
Returns the simulation engine where this object belongs to.
|
Agent | getEnvironment() |
Returns the environment where this agent belongs to.
|
SpaceType | getEnvironmentSpaceType() |
Returns agent space type, if this is an environment and it has spatial information.
|
IExperimentHost | getExperimentHost() |
Returns the experiment host object of the model, or some dummy object
with no functionality if there is none.
|
double | getFirstOccurrenceTime |
Returns the (absolute) time of first occurrence of a timeout event
(of Once or Cyclic mode).
|
double | getFlowchartEntryTime() |
Returns the time the entity has entered the first block in the flowchart,
or
Double.NaN if this agent hasn't yet visited any flowchart |
final String | getFullName() |
Returns the name of the agent prefixed by the path from
the top-level agent to this one.
|
double | getGISHeading() |
Returns current heading angle (measured in radians CW,
starting from North direction) of agent moving in GIS space.
|
AbstractShapeGISMap | getGISMap() |
Returns
AbstractShapeGISMap object used in this GIS environment.Throws error if environment has space type different from GIS. |
double | getHeight() |
Returns the height of the agent (measured in meters) - used by conveyors and
other blocks which require it during processing.
|
double | getHeight |
Returns the height of the agent (measured in the given units) - used by conveyors and
other blocks which require it during processing.
|
int | getId() |
Returns the unique identifier of this agent in the context of the model run
|
int | getIdOf |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons. Returns some ordinal number of this statechart in the agent type (like id, among all statecharts, respecting agent type inheritance) |
int | getIndex() |
For a list-based agent population, returns its index in the list, otherwise
returns
-1 . |
int | getInitialAlgebraicFlatEquationsCount_xjal() |
This method shouldn't be normally called by user.
|
int | getInitialFormulaFlatEquationsCount_xjal() |
This method shouldn't be normally called by user.
|
SDIntegrationManager | getIntegrationManager_xjal() |
This method shouldn't be normally called by user.
Returns static integration manager defined in derived classes. |
double | getLat() |
Deprecated.
use getLatitude()
|
double | getLatitude() |
Returns the current (up-to-date) latitude of the agent in continuous GIS space.
|
LayoutType | getLayoutType() |
Returns the layout type.
|
double | getLength() |
Returns the length of the agent (measured in meters) - used by conveyors and
other blocks which require it during processing.
|
double | getLength |
Returns the length of the agent (measured in the given units) - used by conveyors and
other blocks which require it during processing.
|
Level | getLevel() |
Returns the level this agent lives in, actual for agents in continuous space.
|
Level[] | getLevels() |
Returns array of levels located in this agent, or empty array
|
LinkToAgentCollection<? extends Agent, | getLinkToAgentStandard_xjal() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
double | getLon() |
Deprecated.
use getLongitude()
|
double | getLongitude() |
Returns the current (up-to-date) longitude of the agent in continuous GIS space.
|
EventTimeout.Mode | getModeOf |
Returns mode of a timeout event: Cyclic, Once, User.
Must be implemented in a subclass if there are any timeout events. |
final String | getName() |
Returns the name of this agent, i.e.
|
String | getNameOf |
Returns the name of a simple (not replicated) embedded object.
Must be implemented in a subclass if there are any embedded objects. |
String | getNameOf |
Returns the name of a replicated embedded object.
Must be implemented in a subclass if there are any replicated embedded objects. |
String | getNameOf |
Returns the name of a condition event.
Must be implemented in a subclass if there are any condition events. |
String | getNameOf |
Returns the name of a rate event.
Must be implemented in a subclass if there are any rate events. |
String | getNameOf |
Returns the name of a timeout event.
Must be implemented in a subclass if there are any timeout events. |
String | getNameOf |
Returns the name of a port.
Must be implemented in a subclass if there are any ports. |
String | getNameOf |
Returns the name of a statechart.
Must be implemented in a subclass if there are any statecharts. |
String | getNameOf |
Returns the name of a condition transition.
Must be implemented in a subclass if there are any condition transitions. |
String | getNameOf |
Returns the name of a message transition.
Must be implemented in a subclass if there are any message transitions. |
String | getNameOf |
Returns the name of a rate transition.
Must be implemented in a subclass if there are any rate transitions. |
String | getNameOf |
Returns the name of a timeout transition.
Must be implemented in a subclass if there are any timeout transitions. |
String | getNameOfState |
Returns the name of a statechart state.
Must be implemented in a subclass if there are any states. |
final <T extends Agent> | getNearestAgent |
Returns the nearest agent from the given collection
|
final <T extends Agent> | getNearestAgentByRoute |
Returns the nearest agent from the given collection.
|
Agent[] | getNeighbors() |
Returns the array of neighbor agents, subject to the current
neighborhood type (Euclidean - {N,S,E,W}, Moore - also {..,NW,NW,SE,SW})
|
INetwork | getNetwork() |
Returns the network this agent lives in, actual for agents in continuous space.
|
double | getNetworkConnectionRange() |
Returns the range of agent connections.
|
double | getNetworkConnectionsPerAgent() |
Returns the average (or exact) number of connections per agent.
|
double | getNetworkNeighborLinkProbability() |
Returns the probability of an agent connection to be a neighbour.
|
INode | getNetworkNode() |
Returns the network node this agent currently is located in, actual for agents in continuous space.
|
INetwork[] | getNetworks() |
Returns array of networks located in this agent, or empty array
|
int | getNetworkScaleFreeM() |
Returns the M parameter of a scale free network.
|
NetworkType | getNetworkType() |
Returns the network type.
|
Agent | getOwner() |
Returns the owner agent that encapsulates this one, null if this
is the top-level agent in the model.
|
ShapeEmbeddedObjectPresentation | getOwnerShape() |
Returns the shape on owner's presentation, this object presentation belongs to.
May return null if this object's presentation isn't located anywhere or when it
has no own presentation (e.g. |
<T> T | getParameter |
Returns the value of parameter with the given name.
This method should be overridden in subclasses. Throws error if there is no parameter with the given name. |
String[] | getParameterNames() |
Returns array of all not dynamic parameter names.
|
void | getPhaseVector_xjal |
This method shouldn't be normally called by user.
Assigns given arrays with current variables values |
void | getPhaseVectorForInitialConditions_xjal |
This method shouldn't be normally called by user.
Assigns given arrays with current variables values (the function is used while solving initial conditions loops) |
AgentList<?> | getPopulation() |
For agent population returns the List of agents
embedded in the owner object where this agent belongs to,
null if the object is not replicated |
Position | getPosition() |
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space and its orientation as well.
|
Position | getPosition |
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space and its orientation as well.
|
double | getPresentationScaleOnOwnerSpace() |
Returns the scale of the agent presentation animation
on its space or
1.0 if space isn't defined |
ShapeTopLevelPresentationGroup | getPresentationShape() | |
int | getR() |
Returns the row of the agent's cell.
|
RailwayNetwork[] | getRailwayNetworks() |
Returns array of railway networks located in this agent, or empty array
|
Agent | getRandomConnectedAgent() |
Returns the randomly chosen connected agent.
|
AgentList<?> | getReplicatedCollection() |
Deprecated.
This method may be removed in the next release.
|
AgentList<?> | getReplicatedList() |
For agent population returns the List of agents
embedded in the owner object where this agent belongs to,
null if the object is not replicated |
void | getRightPart_xjal |
This method shouldn't be normally called by user.
Calculates right parts of differential equations and algebraic equations to the given arrays |
void | getRightPartForInitialConditions_xjal |
This method shouldn't be normally called by user.
Returns right part while solving algebraic loops in initial conditions |
RoadNetwork[] | getRoadNetworks() |
Returns array of road networks located in this agent, or empty array
|
Agent | getRootAgent() |
Returns the top-level agent or
null if root couldn't be found |
double | getRotation() |
Returns the current rotation angle (in radians) of the agent in
continuous 3D space or GIS space.
|
IRouteProvider | getRouteProvider() |
Returns the provider of routes for agent movement
|
int | getRuntimeAlgebraicFlatEquationsCount_xjal() |
This method shouldn't be normally called by user.
|
int | getRuntimeFormulaFlatEquationsCount_xjal() |
This method shouldn't be normally called by user.
|
Scale | getScale() |
Returns the scale used by the space of this agent.
The default scale is 10 pixels per meter |
Agent | getSpace() |
Returns the agent representing space this agent lives in
|
double | getSpeed() |
Returns the current value of the agent speed in continuous/GIS space.
|
double | getSpeed |
Returns the current value of the agent speed in continuous/GIS space.
|
Statechart | getStatechartOf |
Returns the statechart where the condition transition belongs to.
Must be implemented in a subclass if there are any condition transitions. |
Statechart | getStatechartOf |
Returns the statechart where the message transition belongs to.
Must be implemented in a subclass if there are any message transitions. |
Statechart | getStatechartOf |
Returns the statechart where the rate transition belongs to.
Must be implemented in a subclass if there are any rate transitions. |
Statechart | getStatechartOf |
Returns the statechart where the timeout transition belongs to.
Must be implemented in a subclass if there are any timeout transitions. |
double | getTargetLat() |
Returns the latitude of the target location if moving, otherwise current latitude in
GIS space, measured in degrees (-90 ...
|
double | getTargetLon() |
Returns the longitude of the target location if moving, otherwise current longitude in
GIS space, measured in degrees (-180 ...
|
double | getTargetX() |
Returns the x of the target location if moving, otherwise current x in
continuous 3D space or GIS space.
In case of GIS environment this is the latitude, measured in degrees (-90 ... |
double | getTargetY() |
Returns the y of the target location if moving, otherwise current y in
continuous 3D space or GIS space.
In case of GIS environment this is the longitude, measured in degrees (-180 ... |
double | getTargetZ() |
Returns the z of the target location if moving, otherwise current z in
continuous space.
|
double | getVelocity() |
Deprecated.
this function is deprecated since AnyLogic 7.1.
|
double | getVerticalRotation() |
Returns the current vertical rotation angle of the agent in
3D space.
|
double | getWidth() |
Returns the width of the agent (measured in meters) - used by conveyors and
other blocks which require it during processing.
|
double | getWidth |
Returns the width of the agent (measured in the given units) - used by conveyors and
other blocks which require it during processing.
|
double | getX() |
Returns the current (up-to-date) x coordinate of the agent in continuous space.
|
Point | getXYZ() |
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space.
|
Point | getXYZ |
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space.
|
double | getY() |
Returns the current (up-to-date) y coordinate of the agent in continuous space.
|
double | getZ() |
Returns the current (up-to-date) z coordinate of the agent in continuous space.
|
void | goToPopulation |
Changes the population of agent.
|
void | highlight |
Turns on/off highlighting of this agent animation.
|
void | instantiateBaseStructure_xjal() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons. |
boolean | inState |
Returns
true if the corresponding statechart of this agent
is at the specified state, i.e. |
boolean | isAgent() |
Returns
true if this is at least an informational agent
(may be with or without spatial properties). |
boolean | isAutomaticHorizontalRotation() |
Returns
true if agent is set to be rotated during movement,
false otherwise |
boolean | isAutomaticVerticalRotation() |
Returns
true if agent is set to be rotated (in vertical direction,
along Z-axis) during movement in 3D, false otherwise.The returned value has no effect if isAutomaticHorizontalRotation() is false |
boolean | isConnectedTo |
Tests if this agent is connected to a given other agent.
|
boolean | isEmbeddedAgentPresentationVisible |
This method is internal and shouldn't be called by user.
This method works only for single embedded objects (not population) inside this agent. Method may be removed/renamed in future. It is public due to technical reasons. |
boolean | isEnvironment() |
Returns
true if this is an environment for agents (at least
informational environment). |
boolean | isLoggingToDB |
Returns
true if this agent and its internals may log their
data/changes/activity to AnyLogic built-in database (logging options are
configurable in the properties of Database / Log in the Projects tree
inside AnyLogic) |
boolean | isLoggingToDB |
Return
true if the given event (or dynamic event) is logged to database
(note that this may be overridden by logging settings of Agent).Default implementation returns true . |
boolean | isMoving() |
Tests if the agent is currently moving in continuous 3D space or GIS space.
|
boolean | isNextCellInsideSpace |
Returns
true if there is an adjacent cell in a given direction. |
boolean | isPublicPresentationDefined() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons. |
boolean | isReplicated() |
Returns
true if this object is embedded in its owner as replicated,
i.e. |
boolean | isSpacePositionSet_xjal() |
Deprecated.
|
void | jumpTo |
Instantly moves the agent to a given location in continuous 3D or GIS space.
|
void | jumpTo |
Instantly moves the agent to a given location.
|
void | jumpTo |
Instantly moves the agent to a given network location.
|
void | jumpTo |
Instantly moves the agent to a given network location.
|
void | jumpTo |
Instantly moves the agent to a given location without.
|
void | jumpTo |
Finds first geographic point on the Earth and calls method jumpTo(latitude, longitude) with coordinates of the found point
|
void | jumpToCell |
Moves the agent into a cell with the given row and column.
|
boolean | jumpToRandomEmptyCell() |
Finds a random empty cell and places the agent there.
|
<T extends Enum<T> & IStatechartState<?, | logToDB |
If logging enabled this method will be called in
#exitState(short, Transition, boolean, Statechart) method |
<T extends Enum<T> & IStatechartState<?, | logToDBEnterState |
If logging enabled this method will be called in
#exitState(short, Transition, boolean, Statechart) method |
<T extends Enum<T> & IStatechartState<?, | logToDBExitState |
If logging enabled this method will be called in
#exitState(short, Transition, boolean, Statechart) method |
void | markParametersAreSet() |
This methods should be used to mark agents created using
no-argument constructor as having all the parameters set.
|
void | moveTo |
Starts movement in the direction of the given target location in continuous 3D or GIS space.
"On arrival" code is executed when movement is finished. |
void | moveTo |
Starts movement in the direction of the given target location in continuous 3D.
"On arrival" code is executed when movement is finished. |
void | moveTo |
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
|
void | moveTo |
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
|
void | moveTo |
Starts movement in the direction of the given agent.
"On arrival" code is executed when movement is finished. |
void | moveTo |
Starts movement to the given attractor.
"On arrival" code is executed when movement is finished. |
void | moveTo |
Starts movement to the given network node.
"On arrival" code is executed when movement is finished. |
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 in continuous 3D.
"On arrival" code is executed when movement is finished. |
void | moveTo |
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
|
void | moveTo |
Finds first geographic point on the Earth and calls method moveTo(latitude, longitude) with coordinates of the found point
|
void | moveToInTime |
Starts movement in the direction of the given target location in continuous 3D or GIS space.
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 in continuous 3D.
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 in continuous 3D.
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 in
continuous 3D space along a given path.
|
void | moveToInTime |
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
|
void | moveToInTime |
Starts movement in the direction of the given target location in continuous 3D or GIS space.
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 in
continuous 3D space along a given path.
|
void | moveToInTime |
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
|
void | moveToInTime |
Starts movement in the direction of the given agent.
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 agent.
Changes the speed of the agent in order to reach target in tripTime ."On arrival" code is executed when movement is finished. |
void | moveToInTime |
Starts movement to the given attractor.
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 attractor.
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 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 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 | moveToInTime |
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
|
void | moveToInTime |
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
|
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 | moveToNextCell |
Moves the agent to an adjacent cell in a given direction.
|
void | moveToStraight |
Starts straight movement (ignoring network/routes) in the direction of the given target location.
"On arrival" code is executed when movement is finished. |
void | moveToStraight |
Starts straight movement (ignoring network) in the direction of the given target location.
"On arrival" code is executed when movement is finished. |
void | moveToStraight |
Starts straight movement (ignoring network/routes) in the direction of the given agent.
"On arrival" code is executed when movement is finished. |
void | moveToStraight |
Starts straight movement (ignoring network/routes) in the direction of the given target location.
"On arrival" code is executed when movement is finished. |
void | moveToStraightInTime |
Starts straight movement (ignoring network) 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 (ignoring network) 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 (ignoring network/routes) 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 (ignoring network/routes) 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 | nothingChanged() |
If called during an event execution, prevents the engine from calling
onChange() of the agent that originated the event. |
void | onAfterStepEnvironment() |
A callback that is called when at the end of every step
after the agents have performed all their step actions.
|
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 | onBeforeCreate() |
Is called at the very start of create() method, i.e.
|
void | onBeforeStep() |
A callback that is called at the beginning of every step
in discrete time before onStep() of any agent is called.
|
void | onBeforeStepEnvironment() |
A callback that is called at the beginning of every step
before the agents are asked to perform any their step actions.
|
void | onChange() |
Notification to the agent meaning "some of your data may have changed
during this event".
|
void | onCreate() |
Is called at the very end of create() method, i.e.
|
void | onDestroy() |
Must be called when the agent is dynamically disposed.
|
void | onEngineFinished() |
Is called by the engine when it finishes running and is intended to
wrap up a single simulation run (e.g.
|
void | onEnterFlowchartBlock |
A callback that is called when the agent enters flowchart block (being an 'entity')
|
void | onExitFlowchartBlock |
A callback that is called when the agent exits flowchart block (being an 'entity')
|
void | onOwnerChanged_xjal() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons. |
void | onReceive |
A callback that is called when the agent receives a message
from another agent.
|
void | onReleaseResource |
A callback that is called when the agent releases resource
|
void | onSeizeResource |
A callback that is called when the agent seizes resource
|
void | onStartup() |
Is called after all activities are started in the object (initial events are
scheduled) and onStartup() has been called for the embedded objects, but
before any steps are made.
|
void | onStep() |
A callback that is called at every step in discrete time
after onStep() of any agent is called.
|
boolean | pauseSimulation() |
Engine command applicable only in RUNNING state (in other states does nothing
and returns
false ). |
void | putPhaseVector_xjal |
This method shouldn't be normally called by user.
Assigns variables values from the given arrays |
void | putPhaseVectorForInitialConditions_xjal |
This method shouldn't be normally called by user.
Assigns variables values from the given arrays (the function is is used while solving initial conditions loops) |
Agent | randomAgentInside() |
Returns a randomly chosen agent in the environment or
null
if there are no agents |
Agent | randomAgentInside |
Returns a randomly chosen agent in the environment or
null
if there are no agents. |
CellPosition | randomEmptyCell() |
Tries to find a pseudo-randomly located empty cell and return its row and column in
the array with two elements.
The current implementation is 100% fairly random. |
Point | randomPointOfSpace() |
Returns the random location inside within the space bounds of this environment
|
void | receive |
Immediately delivers a message to this agent.
|
boolean | removeAgentFromContents |
Removes the given agent from the contents of this agent.
|
boolean | removeEntityFromContents |
Deprecated.
please use
removeAgentFromContents(Agent) |
boolean | removeExt_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. This method removes the given extension if it is found in this agent and return true if it was successfully removed |
void | removeFromFlowchart() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons. |
Agent | resourceUnitOfPool |
Returns the first occurrence of resource unit of a given pool
among the seized resource units, or
null if not found. |
<T extends Agent> | resourceUnits() |
Returns the list of resource units seized by the entity, or empty list
if there are none.
|
<T extends Agent> | resourceUnitsOfPool |
Returns resource units currently seized by this entity
from the given
ResourcePool block |
<T extends Agent> | resourceUnitsOfSeize |
Return resource units currently seized by this entity
in the given
Seize block |
final void | restoreCollection_xjal |
Deprecated.
|
void | restoreConnections_xjal |
Deprecated.
|
void | restoreOwner |
Deprecated.
|
boolean | runSimulation() |
Engine command applicable only in PAUSED state (in other states does nothing
and returns
false ). |
void | send |
Sends a message to a given agent.
|
void | send |
Sends a message to an agent or a group of agents, as specified by the
mode parameter.
|
void | sendToAll |
Sends a message to all agents in the same environment this agent lives in.
|
void | sendToAllConnected |
Sends a message to all connected agents.
|
void | sendToAllNeighbors |
Sends a message to all neighbors.
|
void | sendToRandom |
Sends a message to a randomly chosen agent in the same environment this agent lives in.
|
void | sendToRandomConnected |
Sends a message to a randomly chosen connected agent.
|
void | sendToRandomNeighbor |
Sends a message to a randomly chosen neighbor.
|
void | setAgentSpaceType |
Sets this agent to use the space of the given type.
Will throw an error if agent already has different space type |
void | setAutomaticHorizontalRotation |
Tells agent to rotate automatically during movements.
|
void | setAutomaticVerticalRotation |
Tells agent to rotate automatically (in vertical direction, along Z-axis)
during movements in 3D.
Has no effect if isAutomaticHorizontalRotation() is false |
void | setCell |
Puts the agent into a given cell.
|
void | setColor |
Sets the color of the item's default animation shape.
For custom agent type animation shapes, please use setFillColor and other setters. |
void | setDestroyed() |
Marks this object as subject to destruction after the current step is finished.
|
void | setDimensions |
Sets the length, width, height of the agent
|
void | setDimensions |
Sets the length, width, height of the agent
|
void | setEngine |
Sets the simulation engine for the object.
|
void | setEnvironment |
Sets up time, space, etc.
|
void | setHeight |
Sets the height of the agent
|
void | setHeight |
Sets the height of the agent
|
void | setId | |
void | setLatLon |
Sets the coordinates of the agent location.
|
void | setLayoutType |
Sets the layout type.
|
void | setLength |
Sets the length of the agent.
|
void | setLength |
Sets the length of the agent.
|
void | setLevel |
Sets this agent to live in the level, actual for agents in continuous space.
|
void | setLocation |
Takes position of given agent and sets it to this agent.
|
void | setLocation |
Sets the current network location for the agent
|
void | setLocation |
This method is used for initialization only, for dynamic
assignment, please use
jumpTo(INode) .Sets the coordinates of the agent location and puts it into network node (if network is defined). Should only be used to initialize the agent location. |
void | setLocation |
This method is used for initialization only, for dynamic
assignment, please use
jumpTo(Point) .Sets the coordinates of the agent location. Should only be used to initialize the agent location. |
void | setLocationRandomInside |
This method is used for initialization only, for dynamic
assignment, please use
jumpTo(INode) .Sets the coordinates of the agent location to the randomly chosen point inside the given node and puts it into network node (if network is defined). Should only be used to initialize the agent location. |
void | setNetwork |
Sets this agent to live in the network, actual for agents in continuous and GIS space.
|
void | setNetworkAllInRange |
Sets network type to the one when agents are connected if the
distance between them is not longer that a given one.
|
void | setNetworkNode |
Sets the current network location for the agent
|
void | setNetworkNode |
Sets the current network location for the agent
|
void | setNetworkNode |
Deprecated.
|
void | setNetworkRandom |
Sets network type to random with a given average number of connections per
agent.
|
void | setNetworkRingLattice |
Sets network type to ring lattice.
|
void | setNetworkScaleFree |
Sets the network type to "scale free".
|
void | setNetworkSmallWorld |
Sets network type to "small world".
|
void | setNetworkUserDefined() |
Sets network type to user-defined.
|
boolean | setParameter |
Sets the value to parameter with the given name.
This method should be overridden in subclasses. |
void | setParametersToDefaultValues() |
Sets all not dynamic parameters to their default values.
This method must be implemented in a subclass, during code generation, and it must call super method. This method is designed to be used in custom experiments for easier setup of top-level agent in certain situations. |
void | setPosition |
This method is used for initialization only, for dynamic
assignment, please use
jumpTo(double, double) .Sets the coordinates and orientation of the agent location. Should only be used to initialize the agent location. |
void | setRotation |
Sets the rotation angle (in radians) of the agent animation in continuous 3D space or GIS space.
|
void | setRouteProvider |
Stops agent if it is moving.
|
void | setSpace |
Sets the space for agent.
|
void | setSpeed |
Changes speed of the agent in continuous/GIS space
(measured in meters per second).
If the agent is moving, it continues moving with the new speed. |
void | setSpeed |
Changes speed of the agent in continuous/GIS space
(measured in the given units).
If the agent is moving, it continues moving with the new speed. |
void | setupExt_xjal |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future |
void | setupInitialConditions_xjal |
This method shouldn't be normally called by user.
|
void | setupSpace |
Sets the space to the given dimensions.
|
void | setupSpace |
Sets the space to the given dimensions.
|
void | setupSpace |
Sets the space type to discrete with the given dimensions and neighbourhood
type.
|
void | setupSpace |
Sets the environment to have GIS space to be based on given
gisMap . |
void | setVelocity |
Deprecated.
this function is deprecated since AnyLogic 7.1.
|
void | setVerticalRotation |
Sets the vertical rotation (angle in radians), along Z-axis of the agent animation in 3D
space.
|
void | setWidth |
Sets the width of the agent
|
void | setWidth |
Sets the width of the agent
|
void | setXY |
Sets the coordinates of the agent location.
|
void | setXYZ |
This method is used for initialization only, for dynamic
assignment, please use
jumpTo(double, double) .Sets the coordinates of the agent location in continuous 3D space. Should only be used to initialize the agent location. |
void | setXYZ |
This method is used for initialization only, for dynamic
assignment, please use
jumpTo(double, double) .Sets the coordinates of the agent location in continuous 3D space. Should only be used to initialize the agent location. |
double | spaceCellHeight() |
Returns the height of the cell in discrete space.
|
double | spaceCellWidth() |
Returns the width of the cell in discrete space.
|
int | spaceColumns() |
Returns the number of columns in the space.
|
double | spaceHeight() |
Returns the height of environment continuous or discrete space.
|
int | spaceRows() |
Returns the number of rows in the space.
|
double | spaceWidth() |
Returns the width of environment continuous or discrete space.
|
double | spaceZHeight() |
Returns the height of environment space along Z-axis.
|
final void | start() |
Starts activities (e.g.
|
final void | startAsEmbedded() |
Internal method to be called for embedded agents inside
doStart() of an upper-level agent. |
<T extends Enum<T> & IStatechartState<?, | stateContainsState |
Deprecated.
|
void | stop() |
Stops movement in continuous 3D or GIS space.
|
boolean | stopSimulation() |
Engine command applicable only in any non-IDLE state (in IDLE state does nothing
and returns
false ). |
void | swapWithAgent |
Swaps the cell location of this agent with another agent.
|
void | swapWithCell |
Swaps this agent with an agent at the cell with the given row and column.
|
void | swapWithNextCell |
Swaps the agent with an agent at the adjacent cell in a given direction.
|
boolean | testConditionOf |
Tests the condition expression of a condition event.
Must be implemented in a subclass if there are any condition events. |
boolean | testConditionOf |
Tests the condition expression of a transition event.
Must be implemented in a subclass if there are any condition transitions. |
boolean | testGuardOf |
Tests the guard expression of a condition transition.
Implementation in a subclass can be skipped if the guard(s) are empty. |
boolean | testGuardOf |
Tests the guard expression of a message transition.
Implementation in a subclass can be skipped if the guard(s) are empty. |
boolean | testGuardOf |
Tests the guard expression of a rate transition.
Implementation in a subclass can be skipped if the guard(s) are empty. |
boolean | testGuardOf |
Tests the guard expression of a timeout transition.
Implementation in a subclass can be skipped if the guard(s) are empty. |
boolean | testMessageOf |
Tests the message received by the statechart against the trigger description
of a message transition - for Object message type.
Must be implemented in a subclass if there are any message transitions. |
final double | timeToArrival() |
Returns the time to arrival to the target location in continuous 2D space
or GIS space, in model-time units.
If the agent is not moving, returns 0. |
final double | timeToArrival |
Returns the time to arrival to the target location in continuous 2D space
or GIS space, in model-time units.
If the agent is not moving, returns 0. |
double | toLengthUnits |
Converts the given pixel length to the length units (using scale of this agent which acts as 'Space')
|
double | toPixels |
Converts the length in the given length units to pixels (using scale of this agent which acts as 'Space')
|
String | toString() |
Returns a (possibly, multi-line) textual information on the
agent.
|
final <T extends AgentExtension> | tryExt |
Returns an extension of given type only if this object already
contains such extension.
|
void | warning |
Signals a warning during the model run with warningText preceded by the agent full name.
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API: AnyLogicRuntimePreferences.setEnableWarnings(Boolean) .This method checks against numerous warnings output: In case of multiple warnings having equal warningText , only the first 10 of them are displayed. |
void | warning |
Signals a warning during the model run with warningText preceded by the agent full name.
|
addToDate, addToDate, atan2fast, bernoulli, beta, beta, binomial, binomial, briefInfoOn, castNumberTypes, castTypes, castTypesBack, cauchy, chi2, convertMarkupSegmentDescriptors_xjal, copyToClipboard, copyToClipboard, copyToClipboard, createTableElementDatabaseBuilder, createTrajectoryGIS, createURL_xjal, date, dateToTime, day, deleteFrom, difference, difference, differenceInCalendarUnits, differenceInCalendarUnits, differenceInDateUnits, differenceInDateUnits, differenceInDateUnits, differenceInDateUnits, dirToAngle, dropTime, erlang, error, error, error, errorInModel, errorInModel, errorInModel, executeAction, executeExpression, executeExpression, executeStatement, exponential, exponential, findExistingFile, format, format, format, format, format, format, format, formatAmountUnits, formatDayOfWeek, formatFlowRateUnits, formatGeoHeading, formatLatitude, formatLengthUnits, formatLengthUnits, formatLongitude, formatMonth, formatSpeedUnits, formatTimeInterval, gamma, gamma, gammaLog, geometric, getAmPm, getAmPm, getCanonicalPath, getDatabaseConnection, getDateWithTimeNextTo, getDayOfMonth, getDayOfMonth, getDayOfWeek, getDayOfWeek, getDayOfYear, getDefaultRandomGenerator, getDistance, getDistance, getDistanceFromPointToLine, getDistanceFromPointToLineSq, getDistanceFromPointToSegment, getDistanceFromPointToSegment, getDistanceFromPointToSegmentSq, getDistanceFromPointToSegmentSq, getDistanceGIS, getDistanceGIS, getDistanceSq, getDistanceSq, getFullName, getHour, getHour, getHourOfDay, getHourOfDay, getLength, getLength, getLengthSq, getLengthSq, getMillisecond, getMillisecond, getMinute, getMinute, getMonth, getMonth, getName, getNearestPointOnSegment, getNearestPointOnSegment, getPerformanceParallelWorkersCount_xjal, getRandom, getRandom, getResult, getSecond, getSecond, getTime, getTimeoutToNextTime, getYear, getYear, gumbel1, gumbel2, hour, hypergeometric, insertInto, inspectOf, inspectOfLink_xjal, isFinite, isLineIntersectingLine, isLineIntersectingRectangle, isLoggingClassToDB, isPointInsideRay, isPointInsideRectangle, isPointInsideSegment, isPointOnTheSameLine, isRayIntersectingSegment, joinArrays_xjal, laplace, layoutTypeToString, limit, limit, limitMax, limitMax, limitMin, limitMin, logarithmic, logistic, lognormal, logToDB, logToDB, logToDB, logToDB, millisecond, minute, month, negativeBinomial, negativeBinomial, normal, normal, pareto, pert, poisson, poisson, prepareBeforeExperimentStart_xjal, prepareStatement, pulse, pulseTrain, quantum, ramp, randomColor, randomFalse, randomFrom, randomFrom, randomFrom, randomlyCreate, randomlyCreate, randomTrue, randomWhere, randomWhere, rayleigh, roundToDecimal, roundToInt, second, selectAndDoForEach, selectArrayOfDouble, selectArrayOfInt, selectExists, selectExists, selectFirstValue, selectFirstValue, selectFirstValue, selectFirstValue, selectFrom, selectResultSet, selectTableFunction, selectUniqueValue, selectUniqueValue, selectUniqueValue, selectUniqueValue, selectValues, selectValues, setDefaultRandomGenerator, sqlGetObject, sqlGetObject, sqlGetObject, sqlGetObject, sqlSetObject, sqr, step, time, time, timeToDate, toDate, toDate, toDate, toDateInMillis, toLatitude, toLongitude, toModelRate, toModelTime, toRateUnits, toStringAlignedNameValues, toTimeout, toTimeout, toTimeoutInCalendar, toTimeUnits, trace, trace, traceln, traceln, traceln, traceln, traceln, traceToDB, traceToDB, triangular, triangular, triangularAV, uniform, uniform, uniform_discr, uniform_pos, update, week, weibull, weibull, xidz, year, zidz
createElementDescriptors, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, getElementDesciptors, getElementProperty, getExperiment, getModelElementsShape, getPresentation, getShapeControlDefaultValueBoolean, getShapeControlDefaultValueDouble, getShapeControlDefaultValueInt, getShapeControlDefaultValueString, getViewAreas, iconContains, onSelectionChanged_xjal, onShapeClick, onShapeGroupDraw, presentationContains, readCustomData, updateShapeDynamicProperties, writeCustomData
bernoulli, beta, beta, beta, binomial, binomial, binomial, cauchy, cauchy, chi2, chi2, erlang, erlang, exponential, exponential, exponential, exponential, gamma, gamma, gamma, geometric, gumbel1, gumbel2, hypergeometric, laplace, logarithmic, logistic, lognormal, negativeBinomial, negativeBinomial, normal, normal, normal, normal, pareto, pareto, pert, poisson, poisson, random, randomFalse, randomFrom, randomFrom, randomFrom, randomlyCreate, randomlyCreate, randomTrue, randomWhere, randomWhere, rayleigh, rayleigh, shuffle, triangular, triangular, triangular, triangularAV, uniform, uniform, uniform, uniform_discr, uniform_discr, uniform_pos, weibull, weibull, weibull
@AnyLogicInternalCodegenAPI public static final Object _ARRIVAL_message_xjal
This variable shouldn't be accessed by user:
it is used internally by AnyLogic
and may be renamed/removed in future
public Agent(Engine engine, Agent owner, AgentList<?> ownerPopulation)
Constructs the agent, sets up its owner and list (if replicated).
Should not create any embedded objects: parameters must be set by the
owner after construction and only then create() should be called.
- Parameters:
engine
- the simulation engineowner
- owner agent that encapsulates this one, or null if this is rootownerPopulation
- collection of agent populations where this object belongs to ornull
if not replicated
public Agent()
Create constructor.
This is a way for e.g. simple creation of entities. Note that object is created BUT parameters are not set and its structure is neither created nor started. To set default values of parameters please call
All the agents in the running model should have owner either in the form of population (replicated agent collection or default population of top-level agent - may be accessed through a special extension automatically placed in the top-level agent of the model) or in the form of direct link (only for agents embedded in the AnyLogic IDE).
The only agent in the model having
This is a way for e.g. simple creation of entities. Note that object is created BUT parameters are not set and its structure is neither created nor started. To set default values of parameters please call
setParametersToDefaultValues()
,
and to create structure and start please
either call createAndStart(Agent)
or goToPopulation(AgentList)
note that these 2 functions will call setParametersToDefaultValues()
if
it hasn't yet been called or if the agent has been created using other constructor
(with parameters or with Engine-Agent-Population).
Note that these functions are automatically called by AnyLogic libraries,
therefore you don't need to call them for entities.All the agents in the running model should have owner either in the form of population (replicated agent collection or default population of top-level agent - may be accessed through a special extension automatically placed in the top-level agent of the model) or in the form of direct link (only for agents embedded in the AnyLogic IDE).
The only agent in the model having
null
owner is top-level agent.public void setEngine(Engine engine)
Sets the simulation engine for the object. Is needed when a default
constructor is invoked.
- Parameters:
engine
- the simulation engine that will handle this object
public Engine getEngine()
Returns the simulation engine where this object belongs to.
- Specified by:
getEngine
in classPresentable
- Returns:
- the simulation engine.
public int getId()
Returns the unique identifier of this agent in the context of the model run
- Returns:
- the unique identifier of this agent
- Since:
- 7.2
@AnyLogicInternalAPI public void setId(int id)
@AnyLogicInternalAPI public int getAgentTypeId()
Returns the unique identifier of agent's type
- Returns:
- the unique identifier of agent's type
- Since:
- 7.2
@AnyLogicInternalAPI public <T extends Enum<T> & IStatechartState<?,T>> void logToDB(Statechart<T> statechart, Transition transition, T fromState)
If logging enabled this method will be called in
#exitState(short, Transition, boolean, Statechart)
method@AnyLogicInternalAPI public <T extends Enum<T> & IStatechartState<?,T>> void logToDBEnterState(Statechart<T> statechart, T state)
If logging enabled this method will be called in
#exitState(short, Transition, boolean, Statechart)
method@AnyLogicInternalAPI public <T extends Enum<T> & IStatechartState<?,T>> void logToDBExitState(Statechart<T> statechart, T state)
If logging enabled this method will be called in
#exitState(short, Transition, boolean, Statechart)
methodpublic IExperimentHost getExperimentHost()
Description copied from class:
Presentable
Returns the experiment host object of the model, or some dummy object
with no functionality if there is none.
- Specified by:
getExperimentHost
in classPresentable
- Returns:
- the experiment host object of the model
public final String getName()
Returns the name of this agent, i.e. the name of its instance
in the owner object, with the index in square brackets for replicated
objects. For the top-level agent returns "root". For default population,
the population name is "<population>".
- Returns:
- the short name of the object not including path from root
public final String getFullName()
Returns the name of the agent prefixed by the path from
the top-level agent to this one.
- Returns:
- the full name of the object including path from root
public String toString()
Returns a (possibly, multi-line) textual information on the
agent. By default returns its full name, but mat be
overridden in subclasses.
public RuntimeException error(Throwable cause, String errorText)
Description copied from class:
Utilities
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
- Specified by:
error
in classUtilities
- Parameters:
cause
- the cause (which will be saved for more detailed message), may benull
errorText
- the text describing the error that will be displayed.- Returns:
- actually this method never returns, it throws runtime exception
by itself.
But the return type is defined for some cases when you would like to use the following form of call:throw error("my message");
public RuntimeException errorInModel(Throwable cause, String errorText)
Description copied from class:
Utilities
Signals an model logic error during the model run by throwing a ModelException
with errorText preceded by the agent full name.
This method differs from
This method differs from
error()
in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. Examples
are 'entity was unable to leave flowchart block because subsequent block was busy',
'insufficient capacity of pallet rack' etc.- Specified by:
errorInModel
in classUtilities
- Parameters:
cause
- the cause (which will be saved for more detailed message), may benull
errorText
- the text describing the error that will be displayed.- Returns:
- actually this method never returns, it throws runtime exception
by itself.
But the return type is defined for some cases when you would like to use the following form of call:throw errorInModel("my message");
public void warning(String warningText)
Description copied from class:
Utilities
Signals a warning during the model run with warningText preceded by the agent full name.
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
This method checks against numerous warnings output:
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
AnyLogicRuntimePreferences.setEnableWarnings(Boolean)
.This method checks against numerous warnings output:
- In case of multiple warnings having equal
warningText
, only the first 10 of them are displayed. - When more than 1000 warnings having different
warningText
occur, all the subsequent warnings (including new occurrences of those in the first 1000) will stop displaying. - Be careful with using dynamically changing
warningText
(e.g. listing names of agents), it could be better to useUtilities.warning(String, Object...)
.
public void warning(String warningTextFormat, Object... args)
Description copied from class:
Utilities
Signals a warning during the model run with warningText preceded by the agent full name.
The method allows warning format syntax like in
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
This method checks against numerous warnings output:
String.format(String, Object...)
method.Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
AnyLogicRuntimePreferences.setEnableWarnings(Boolean)
.This method checks against numerous warnings output:
- In case of multiple warnings having equal
warningTextFormat
, only the first 10 of them are displayed. - It is safe to raise numerous warnings with equal format string (which defines the warning type) but varying
args
- AnyLogic will take care to display only10
first warnings of each warning type. - When more than 1000 warnings having different
warningTextFormat
occur, all the subsequent warnings (including new occurrences of those in the first 1000) will stop displaying. - Don't use dynamically changing
warningTextFormat
(e.g. listing names of agents), useargs
instead.
public Agent getOwner()
Returns the owner agent that encapsulates this one, null if this
is the top-level agent in the model.
- Returns:
- owner agent or null
public Scale getScale()
Returns the scale used by the space of this agent.
The default scale is 10 pixels per meter
The default scale is 10 pixels per meter
- Returns:
- the scale used by the space of this agent
public double toLengthUnits(double lengthInPixels, LengthUnits units)
Converts the given pixel length to the length units (using scale of this agent which acts as 'Space')
- Parameters:
lengthInPixels
- the length in pixels (in the scope of this agent which acts as 'Space')units
- length units- Returns:
- result in length units
public double toPixels(double lengthInUnits, LengthUnits units)
Converts the length in the given length units to pixels (using scale of this agent which acts as 'Space')
- Parameters:
lengthInUnits
- the length inunits
units
- length units- Returns:
- result in pixels (in the scope of this agent which acts as 'Space')
public INetwork[] getNetworks()
Returns array of networks located in this agent, or empty array
- Returns:
- array of networks located in this agent
public Level[] getLevels()
Returns array of levels located in this agent, or empty array
- Returns:
- array of levels located in this agent
public RailwayNetwork[] getRailwayNetworks()
Returns array of railway networks located in this agent, or empty array
- Returns:
- array of railway networks located in this agent
public RoadNetwork[] getRoadNetworks()
Returns array of road networks located in this agent, or empty array
- Returns:
- array of road networks located in this agent
public ConveyorNetwork[] getConveyorNetworks()
Returns array of conveyor networks located in this agent, or empty array
- Returns:
- array of conveyor networks located in this agent
@AnyLogicLegacyAPI public ShapeEmbeddedObjectPresentation getOwnerShape()
Returns the shape on owner's presentation, this object presentation belongs to.
May return
May return
null
if this object's presentation isn't located anywhere or when it
has no own presentation (e.g. it is of plain Agent class)- Returns:
- the shape on owner's presentation, this object presentation belongs to
public List<Object> getEmbeddedObjects()
Creates and returns a list of embedded objects if there are any, null
if there are none. For a agent population its list is included in the
result, not each object, therefore the resulting list contains either
instances of
This function must be implemented in a subclass if there is at least one embedded object.
Agent
or of
AgentList
<? extends Agent
>
This function must be implemented in a subclass if there is at least one embedded object.
- Returns:
- the newly created list of all embedded objects, or null
public boolean isReplicated()
Returns
true
if this object is embedded in its owner as replicated,
i.e. as a member of a list of objects.- Returns:
true
if this object is replicated,false
otherwise.
public int getIndex()
For a list-based agent population, returns its index in the list, otherwise
returns
-1
. Current implementation is very inefficient (linear complexity) and
will be changed!- Returns:
- index of this object in the replicated list or
-1
- Throws:
RuntimeException
- if agent population is notlist-based
.
@AnyLogicLegacyAPI @Deprecated public AgentList<?> getReplicatedCollection()
Deprecated.
This method may be removed in the next release. Please use
getReplicatedList()
instead@AnyLogicLegacyAPI public AgentList<?> getReplicatedList()
For agent population returns the List of agents
embedded in the owner object where this agent belongs to,
null
if the object is not replicated- Returns:
- the List where this object belongs to, or
null
public AgentList<?> getPopulation()
For agent population returns the List of agents
embedded in the owner object where this agent belongs to,
null
if the object is not replicated- Returns:
- the List where this object belongs to, or
null
public void goToPopulation(AgentList newPopulation)
Changes the population of agent. Agent will leave its current environment (if any was)
and come into environment of the
If
newPopulation
(if it lives in an
environment).If
newPopulation
is null
then the agent
will go into 'default population' of top-level agent of model and will leave
its environment (if any was).- Parameters:
newPopulation
- the new population ornull
if the agent is intended to go into 'default population' of top-level agent of model.
@AnyLogicInternalCodegenAPI public void onOwnerChanged_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
it may be removed/renamed in future. It is public due to technical reasons.
@AnyLogicInternalCodegenAPI public void instantiateBaseStructure_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
it may be removed/renamed in future. It is public due to technical reasons.
public void deleteSelf()
Removes this agent from the agent population (replicated agent list) it belongs to.
Throws error if agent belongs to some flowchart block (it is an 'entity'). Also
throws error if the agent doesn't belong to any population (e.g. when it is a
single, not replicated agent.
- Since:
- 7.0
@AnyLogicInternalCodegenAPI public void removeFromFlowchart()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
it may be removed/renamed in future. It is public due to technical reasons.
@AnyLogicInternalCodegenAPI public void onBeforeCreate()
Is called at the very start of create() method, i.e. when all
parameters have been initialized but before the internal structure like
embedded objects is created.
By default this method does nothing, but can be defined by the user.
- Since:
- 7.2
- See Also:
-
onCreate()
@AnyLogicInternalCodegenAPI public void onCreate()
Is called at the very end of create() method, i.e. when all
parameters have been initialized, embedded objects are created (and their
onCreate() has been called), but before any activities are started
(no events are scheduled yet), thus also before the startup code is executed.
By default this method does nothing, but can be defined by the user.
@AnyLogicInternalCodegenAPI public void onStartup()
Is called after all activities are started in the object (initial events are
scheduled) and onStartup() has been called for the embedded objects, but
before any steps are made. By default this method does nothing, but can be
defined by the user by filling out the startup code section.
public void onChange()
Notification to the agent meaning "some of your data may have changed
during this event". Causes:
1. Re-evaluation of conditions in events and statechart transitions with Condition triggers
2. Re-calculation of rates in events and statechart transitions with Rate triggers
By default this method is called if the agent originates an event or if a message is received by one of its ports. This can be prevented by calling
You can also manually call this function if you wish some agent to notice the change even if it had no events.
1. Re-evaluation of conditions in events and statechart transitions with Condition triggers
2. Re-calculation of rates in events and statechart transitions with Rate triggers
By default this method is called if the agent originates an event or if a message is received by one of its ports. This can be prevented by calling
nothingChanged()
.You can also manually call this function if you wish some agent to notice the change even if it had no events.
public void nothingChanged()
If called during an event execution, prevents the engine from calling
onChange()
of the agent that originated the event. Has effect only
within one event. Does not affect other agents where the user may have
manually called onChange()
or it may have got called by ports, etc.public Set<DynamicEvent> getDynamicEvents()
Returns the set of all currently existing dynamic events of this agent.
The user should not change this set.
- Returns:
- the set of active dynamic events
@AnyLogicInternalCodegenAPI public boolean isPublicPresentationDefined()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
it may be removed/renamed in future. It is public due to technical reasons.
@AnyLogicInternalCodegenAPI public boolean isEmbeddedAgentPresentationVisible(Agent embeddedAgent)
This method is internal and shouldn't be called by user.
This method works only for single embedded objects (not population) inside this agent.
Method may be removed/renamed in future. It is public due to technical reasons.
This method works only for single embedded objects (not population) inside this agent.
Method may be removed/renamed in future. It is public due to technical reasons.
@AnyLogicInternalCodegenAPI public String getNameOf(EventTimeout e)
Returns the name of a timeout event.
Must be implemented in a subclass if there are any timeout events.
Must be implemented in a subclass if there are any timeout events.
- Parameters:
e
- the event- Returns:
- event name
@AnyLogicInternalCodegenAPI public EventTimeout.Mode getModeOf(EventTimeout e)
Returns mode of a timeout event: Cyclic, Once, User.
Must be implemented in a subclass if there are any timeout events.
Must be implemented in a subclass if there are any timeout events.
- Parameters:
e
- the event- Returns:
- event mode
@AnyLogicInternalCodegenAPI public double getFirstOccurrenceTime(EventTimeout e)
Returns the (absolute) time of first occurrence of a timeout event
(of Once or Cyclic mode). Must be implemented in a subclass if there are any
such timeout events.
- Parameters:
e
- the event- Returns:
- the time of first occurrence, 0 by default
@AnyLogicInternalCodegenAPI public double evaluateTimeoutOf(EventTimeout e)
Evaluates timeout expression of a timeout event.
Must be implemented in a subclass if there are any timeout events.
Must be implemented in a subclass if there are any timeout events.
- Parameters:
e
- the event- Returns:
- the timeout value
@AnyLogicInternalCodegenAPI public void executeActionOf(EventTimeout e)
Executes action of a timeout event.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
e
- the event
@AnyLogicInternalCodegenAPI public String getNameOf(EventRate e)
Returns the name of a rate event.
Must be implemented in a subclass if there are any rate events.
Must be implemented in a subclass if there are any rate events.
- Parameters:
e
- the event- Returns:
- event name
@AnyLogicInternalCodegenAPI public double evaluateRateOf(EventRate e)
Evaluates the rate expression of a rate event.
Must be implemented in a subclass if there are any rate events.
Must be implemented in a subclass if there are any rate events.
- Parameters:
e
- the event- Returns:
- the rate value
@AnyLogicInternalCodegenAPI public void executeActionOf(EventRate e)
Executes action of a rate event.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
e
- the event
@AnyLogicInternalCodegenAPI public String getNameOf(EventCondition e)
Returns the name of a condition event.
Must be implemented in a subclass if there are any condition events.
Must be implemented in a subclass if there are any condition events.
- Parameters:
e
- the event- Returns:
- event name
@AnyLogicInternalCodegenAPI public boolean testConditionOf(EventCondition e)
Tests the condition expression of a condition event.
Must be implemented in a subclass if there are any condition events.
Must be implemented in a subclass if there are any condition events.
- Parameters:
e
- the event- Returns:
- result of condition evaluation
@AnyLogicInternalCodegenAPI public void executeActionOf(EventCondition e)
Executes action of a condition event.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
e
- the event
@AnyLogicInternalCodegenAPI public boolean isLoggingToDB(EventOriginator e)
Return
Default implementation returns
true
if the given event (or dynamic event) is logged to database
(note that this may be overridden by logging settings of Agent).Default implementation returns
true
. Must be implemented in a subclass
if there are any events with logging turned off.- Parameters:
e
- the event- Returns:
false
to force disable logging, otherwisetrue
public boolean isLoggingToDB(LoggingType loggingType)
Description copied from class:
Utilities
Returns
true
if this agent and its internals may log their
data/changes/activity to AnyLogic built-in database (logging options are
configurable in the properties of Database / Log in the Projects tree
inside AnyLogic)- Overrides:
isLoggingToDB
in classUtilities
- Parameters:
loggingType
- type of logging- Returns:
true
if logged, false otherwise
public boolean inState(IStatechartState<?, ?> state)
Returns
true
if the corresponding statechart of this agent
is at the specified state, i.e. exactly in
the state for a simple state and in one of its inner states for a composite state.- Parameters:
state
- the state- Returns:
true
if state is currently active- Since:
- 7.0.2
@AnyLogicInternalCodegenAPI public String getNameOf(Statechart<?> s)
Returns the name of a statechart.
Must be implemented in a subclass if there are any statecharts.
Must be implemented in a subclass if there are any statecharts.
- Parameters:
s
- the statechart- Returns:
- statechart name
@AnyLogicInternalCodegenAPI public int getIdOf(Statechart<?> s)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
Returns some ordinal number of this statechart in the agent type (like id, among all statecharts, respecting agent type inheritance)
it may be removed/renamed in future. It is public due to technical reasons.
Returns some ordinal number of this statechart in the agent type (like id, among all statecharts, respecting agent type inheritance)
- Parameters:
s
- the statechart- Returns:
- statechart id
@AnyLogicInternalCodegenAPI public void executeActionOf(Statechart<?> s)
Executes startup action of a statechart: calls actions of the statechart
entry point, entry action of initial states, starts the corresponding transitions,
etc., and sets up the initially active simple state.
Must be implemented in a subclass if there are any statecharts.
Must be implemented in a subclass if there are any statecharts.
- Parameters:
s
- the statechart
public String getNameOfState(IStatechartState<?, ?> state)
Returns the name of a statechart state.
Must be implemented in a subclass if there are any states.
Must be implemented in a subclass if there are any states.
- Parameters:
state
- the state- Returns:
- state name
- See Also:
-
IStatechartState.name()
@Deprecated @AnyLogicInternalCodegenAPI public <T extends Enum<T> & IStatechartState<?,T>> boolean stateContainsState(T compstate, T simpstate)
Deprecated.
This method is internal, deprecated and will be removed in the next release.>
@Deprecated @AnyLogicInternalCodegenAPI public <T extends Enum<T> & IStatechartState<?,T>> T getContainerStateOf(T state)
Deprecated.
This method is internal, deprecated and will be removed in the next release.>
@AnyLogicInternalCodegenAPI public String getNameOf(TransitionTimeout t)
Returns the name of a timeout transition.
Must be implemented in a subclass if there are any timeout transitions.
Must be implemented in a subclass if there are any timeout transitions.
- Parameters:
t
- the transition- Returns:
- transition name
@AnyLogicInternalCodegenAPI public double evaluateTimeoutOf(TransitionTimeout t)
Evaluates timeout expression of a timeout transition.
Must be implemented in a subclass if there are any timeout transitions.
Must be implemented in a subclass if there are any timeout transitions.
- Parameters:
t
- the transition- Returns:
- the timeout value
@AnyLogicInternalCodegenAPI public boolean testGuardOf(TransitionTimeout t)
Tests the guard expression of a timeout transition.
Implementation in a subclass can be skipped if the guard(s) are empty.
Implementation in a subclass can be skipped if the guard(s) are empty.
- Parameters:
t
- the transition- Returns:
- result of guard evaluation
@AnyLogicInternalCodegenAPI public void executeActionOf(TransitionTimeout t)
Executes action of a timeout transition.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
t
- the transition
@AnyLogicInternalCodegenAPI public Statechart getStatechartOf(TransitionTimeout t)
Returns the statechart where the timeout transition belongs to.
Must be implemented in a subclass if there are any timeout transitions.
Must be implemented in a subclass if there are any timeout transitions.
- Parameters:
t
- the transition.- Returns:
- the statechart of the transition
@AnyLogicInternalCodegenAPI public String getNameOf(TransitionRate t)
Returns the name of a rate transition.
Must be implemented in a subclass if there are any rate transitions.
Must be implemented in a subclass if there are any rate transitions.
- Parameters:
t
- the transition- Returns:
- transition name
@AnyLogicInternalCodegenAPI public double evaluateRateOf(TransitionRate t)
Evaluates the rate expression of a rate transition.
Must be implemented in a subclass if there are any rate transitions.
Must be implemented in a subclass if there are any rate transitions.
- Parameters:
t
- the transition- Returns:
- the rate value
@AnyLogicInternalCodegenAPI public boolean testGuardOf(TransitionRate t)
Tests the guard expression of a rate transition.
Implementation in a subclass can be skipped if the guard(s) are empty.
Implementation in a subclass can be skipped if the guard(s) are empty.
- Parameters:
t
- the transition- Returns:
- result of guard evaluation
@AnyLogicInternalCodegenAPI public void executeActionOf(TransitionRate t)
Executes action of a rate transition.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
t
- the transition
@AnyLogicInternalCodegenAPI public Statechart getStatechartOf(TransitionRate t)
Returns the statechart where the rate transition belongs to.
Must be implemented in a subclass if there are any rate transitions.
Must be implemented in a subclass if there are any rate transitions.
- Parameters:
t
- the transition.- Returns:
- the statechart of the transition
@AnyLogicInternalCodegenAPI public String getNameOf(TransitionCondition t)
Returns the name of a condition transition.
Must be implemented in a subclass if there are any condition transitions.
Must be implemented in a subclass if there are any condition transitions.
- Parameters:
t
- the transition- Returns:
- transition name
@AnyLogicInternalCodegenAPI public boolean testConditionOf(TransitionCondition t)
Tests the condition expression of a transition event.
Must be implemented in a subclass if there are any condition transitions.
Must be implemented in a subclass if there are any condition transitions.
- Parameters:
t
- the transition- Returns:
- result of condition evaluation
@AnyLogicInternalCodegenAPI public boolean testGuardOf(TransitionCondition t)
Tests the guard expression of a condition transition.
Implementation in a subclass can be skipped if the guard(s) are empty.
Implementation in a subclass can be skipped if the guard(s) are empty.
- Parameters:
t
- the transition- Returns:
- result of guard evaluation
@AnyLogicInternalCodegenAPI public void executeActionOf(TransitionCondition t)
Executes action of a condition transition.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
t
- the transition
@AnyLogicInternalCodegenAPI public Statechart getStatechartOf(TransitionCondition t)
Returns the statechart where the condition transition belongs to.
Must be implemented in a subclass if there are any condition transitions.
Must be implemented in a subclass if there are any condition transitions.
- Parameters:
t
- the transition.- Returns:
- the statechart of the transition
@AnyLogicInternalCodegenAPI public String getNameOf(TransitionMessage t)
Returns the name of a message transition.
Must be implemented in a subclass if there are any message transitions.
Must be implemented in a subclass if there are any message transitions.
- Parameters:
t
- the transition- Returns:
- transition name
@AnyLogicInternalCodegenAPI public boolean testMessageOf(TransitionMessage t, Object msg)
Tests the message received by the statechart against the trigger description
of a message transition - for Object message type.
Must be implemented in a subclass if there are any message transitions.
Must be implemented in a subclass if there are any message transitions.
- Parameters:
t
- the transition.msg
- the message received- Returns:
true
if the message matches the trigger,false
otherwise
@AnyLogicInternalCodegenAPI public boolean testGuardOf(TransitionMessage t)
Tests the guard expression of a message transition.
Implementation in a subclass can be skipped if the guard(s) are empty.
Implementation in a subclass can be skipped if the guard(s) are empty.
- Parameters:
t
- the transition- Returns:
- result of guard evaluation
@AnyLogicInternalCodegenAPI public void executeActionOf(TransitionMessage t, Object msg)
Executes action of a message transition for Object message type - depends on the message.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
t
- the transitionmsg
- the message received
@AnyLogicInternalCodegenAPI public void executeActionOf(TransitionMessage t, int msg)
Executes action of a message transition for int message type - depends on the message.
Implementation in a subclass can be skipped if the action(s) are empty.
Implementation in a subclass can be skipped if the action(s) are empty.
- Parameters:
t
- the transitionmsg
- the message received
@AnyLogicInternalCodegenAPI public Statechart getStatechartOf(TransitionMessage t)
Returns the statechart where the message transition belongs to.
Must be implemented in a subclass if there are any message transitions.
Must be implemented in a subclass if there are any message transitions.
- Parameters:
t
- the transition.- Returns:
- the statechart of the transition
@AnyLogicInternalCodegenAPI public String getNameOf(Port<?, ?> p)
Returns the name of a port.
Must be implemented in a subclass if there are any ports.
Must be implemented in a subclass if there are any ports.
- Parameters:
p
- the port- Returns:
- port name
@AnyLogicInternalCodegenAPI public boolean executeOnSendActionOf(Port<?, ?> p, Object msg)
Executes action associated with a message being sent via a port.
The code may analyze the message and prevent the port from continuing
processing it by returning
Implementation in a subclass can be skipped if all actions are empty. Otherwise, for all empty actions
false
.Implementation in a subclass can be skipped if all actions are empty. Otherwise, for all empty actions
true
must be returned.- Parameters:
p
- the portmsg
- the message being sent
@AnyLogicInternalCodegenAPI public boolean executeOnReceiveActionOf(Port<?, ?> p, Object msg)
Executes action code associated with a message being received at a port.
The code may analyze the message and prevent the port from continuing
processing it by returning
Implementation in a subclass can be skipped if all actions are empty. Otherwise, for all empty actions
false
.Implementation in a subclass can be skipped if all actions are empty. Otherwise, for all empty actions
true
must be returned.- Parameters:
p
- the portmsg
- the message being received
@AnyLogicInternalCodegenAPI public String getNameOf(Agent ao)
Returns the name of a simple (not replicated) embedded object.
Must be implemented in a subclass if there are any embedded objects.
Must be implemented in a subclass if there are any embedded objects.
- Parameters:
ao
- the embedded agent- Returns:
- embedded object name
@AnyLogicInternalCodegenAPI public String getNameOf(AgentList<?> aocollection)
Returns the name of a replicated embedded object.
Must be implemented in a subclass if there are any replicated embedded objects.
Must be implemented in a subclass if there are any replicated embedded objects.
- Parameters:
aocollection
- the embedded collection of agents- Returns:
- embedded object list name
@AnyLogicInternalCodegenAPI public AgentAnimationSettings getAnimationSettingsOf(Agent ao)
Returns the animation settings of a simple (not replicated) embedded object.
Must be implemented in a subclass if there are any embedded objects.
Must be implemented in a subclass if there are any embedded objects.
- Parameters:
ao
- the embedded agent- Returns:
- embedded object animation settings
@AnyLogicInternalCodegenAPI public AgentAnimationSettings getAnimationSettingsOf(AgentList<?> aocollection)
Returns the animation settings of a replicated embedded object.
Must be implemented in a subclass if there are any replicated embedded objects.
Must be implemented in a subclass if there are any replicated embedded objects.
- Parameters:
aocollection
- the embedded collection of agents- Returns:
- embedded object list animation settings
@AnyLogicInternalCodegenAPI public int getCameras3D(Map<String, Camera3D> output)
Adds all
Default implementation does nothing and returns
Camera3D
of this agent to the given
map output
, if it is not null
.Default implementation does nothing and returns
0
.- Parameters:
output
- the map for 3D cameras (field name -> 3D camera), not cleared by this method, may benull
: in this case the method only returns the number of 3D cameras.- Returns:
- the number of 3D cameras in this agent
@AnyLogicInternalCodegenAPI public void drawLinksToAgents(boolean underAgents, LinkToAgentAnimator animator)
This method automatically generated by AnyLogic. Users shouldn't explicitly use it.
This method should be overridden to draw all links
- Parameters:
underAgents
- this argument tell which links should be drawn (true
= links which are drawn behind agent animations,false
- links which are drawn on top of agent animations)
@AnyLogicInternalCodegenAPI public static Engine _initGetEngine_xjal(Agent owner)
This method shouldn't be called by user.
It is public due to technical reasons.
public void createAndStart(Agent anyAgent)
Assigns the owner of the agent to the top-level agent of the model, creates the internal
structure of the agent (internally embedded agents, statecharts etc.)
and starts it (thus its statechart and events start living).
This method should be called for all agents customly
created in modeler's "java code" by using no-argument
constructor.
This method shouldn't be called for any agents created in usual way in the AnyLogic IDE and for agents created in AnyLogic library blocks (like Source, PedSource etc.) as well as it shouldn't be called twice.
This method shouldn't be called for any agents created in usual way in the AnyLogic IDE and for agents created in AnyLogic library blocks (like Source, PedSource etc.) as well as it shouldn't be called twice.
- Parameters:
anyAgent
- absolutely any valid agent of the model, it is needed to obtain top-level agent of the model (which will become the true 'owner' of created agent), should be notnull
and should have a reference to a valid Engine.
public Agent getRootAgent()
Returns the top-level agent or
null
if root couldn't be found- Returns:
- the top-level agent
public AgentList<Agent> getDefaultPopulation()
Returns the default population (contained in top-level agent) or
null
if root couldn't be found- Returns:
- the default population
public void setParametersToDefaultValues()
Sets all not dynamic parameters to their default values.
This method must be implemented in a subclass, during code generation, and it must call super method.
This method is designed to be used in custom experiments for easier setup of top-level agent in certain situations.
This method must be implemented in a subclass, during code generation, and it must call super method.
This method is designed to be used in custom experiments for easier setup of top-level agent in certain situations.
public void markParametersAreSet()
This methods should be used to mark agents created using
no-argument constructor as having all the parameters set.
This will prevent agents for parameters initialization
in the first place where they will be sent (in library
blocks, populations etc. - they usually call setParametersToDefaultValues()
and then call create() and start())
public boolean setParameter(String name, Object value, boolean callOnChange)
Sets the value to parameter with the given name.
This method should be overridden in subclasses.
This method should be overridden in subclasses.
- Parameters:
name
- the name of (not dynamic) parametervalue
- the value to be setcallOnChange
-true
to call on change code- Returns:
true
if successful,false
if parameter wasn't found
public <T> T getParameter(String name)
Returns the value of parameter with the given name.
This method should be overridden in subclasses.
Throws error if there is no parameter with the given name.
This method should be overridden in subclasses.
Throws error if there is no parameter with the given name.
- Parameters:
name
- the name of (not dynamic) parameter- Returns:
- the value
- Since:
- 7.2
public String[] getParameterNames()
Returns array of all not dynamic parameter names.
- Returns:
- names of parameters
- Since:
- 7.2
- See Also:
-
getParameter(String)
public final void create()
Creates the agent embedded objects; also calls user's
If there are any embedded objects,
onBeforeCreate()
at the beginning and onCreate()
at the end.
Is called after the agent has been constructed and
its parameters have been setup by the owner object.If there are any embedded objects,
doCreate()
method
should be implemented in subclass@AnyLogicInternalCodegenAPI public final void createAsEmbedded()
Internal method to be called for embedded agents inside
doCreate()
of an upper-level agent.- Since:
- 8.4
@AnyLogicInternalCodegenAPI public void doAfterCreate()
Internal callback to perform additional "after all agents created" actions.
- Since:
- 8.4
@AnyLogicInternalCodegenAPI public void doCreate()
Creates the agent embedded objects.
If there are any embedded objects, this method should be implemented in subclass to instantiate them, setup their parameters and call
If there are any embedded objects, this method should be implemented in subclass to instantiate them, setup their parameters and call
agent.createAsEmbedded()
method on each agent
.- Since:
- 7.2
@AnyLogicInternalCodegenAPI public final void start()
Starts activities (e.g. schedules initial events) in this agent:
events, statecharts and embedded objects, submits equations.
Method
doStart()
should be implemented in subclasses
by default does nothing.@AnyLogicInternalCodegenAPI public final void startAsEmbedded()
Internal method to be called for embedded agents inside
doStart()
of an upper-level agent.- Since:
- 8.4
@AnyLogicInternalCodegenAPI public void doStart()
Starts activities (e.g. schedules initial events) in this agent:
events, statecharts and embedded objects, submits equations.
Should be implemented in subclasses, by default does nothing.
If there are any embedded objects, this method should be implemented in subclass to call
If there are any embedded objects, this method should be implemented in subclass to call
agent.startAsEmbedded()
method on each agent
.- Since:
- 7.2
public boolean stopSimulation()
Engine command applicable only in any non-IDLE state (in IDLE state does nothing
and returns
false
). If the state is RUNNING, sets a flag that, when tested by the
model execution thread, causes it to terminate. Further behavior depends on context
where this method is called:
- When this method is called from the model execution thread, or from control
action code, or from on-click code of a shape, it returns
true
immediately, leaving the model in PLEASE_WAIT state. Model is stopped and destroyed some time later (After Simulation Run code of an experiment or On Destroy code of top-level agent may be used to handle this moment)
It is more recommended to usefinishSimulation()
method in such situations - When this method is called from other locations (e.g. user-defined concurrent thread),
it waits for the model execution thread to terminate and then destroys the model
(calls root.onDestroy()) and forgets it. Then puts the engine into IDLE state
and returns
true
.
- See Also:
-
Engine.stop()
public boolean finishSimulation()
Engine command applicable only in RUNNING or PAUSED state (in other states
does nothing and returns
false
). Sets a flag that, when tested by the engine,
causes it to finish after completing the current event execution. Further behavior
depends on context where this method is called:
- When this method is called from the model execution thread, control action code,
or from on-click code of a shape, it returns
true
immediately. Model is finished just after current event execution (After Simulation Run code of an experiment may be used to handle this moment)
- When this method is called from other locations (e.g. user-defined concurrent thread),
it waits for the model execution thread to terminate and returns
true
.
- Returns:
false
if the engine state does not allow pausing- See Also:
-
Engine.finish()
public boolean pauseSimulation()
Engine command applicable only in RUNNING state (in other states does nothing
and returns
false
). Puts the engine into PLEASE_WAIT state and then sets a flag
that, when tested by the engine, causes it to pause after completing the
current event execution. Further behavior depends on context where this method is called:
- When this method is called from the model execution thread, from control
action code, or from on-click code of a shape,
it returns
true
immediately. Model is finished just after current event execution - When this method is called from other locations (e.g. user-defined concurrent thread),
it waits for the model execution thread to terminate and returns
true
.
- Returns:
false
if the engine state does not allow pausing- See Also:
-
Engine.pause()
public boolean runSimulation()
Engine command applicable only in PAUSED state (in other states does nothing
and returns
- there are no more events to execute (state -> FINISHED)
- stopTime is reached (state -> FINISHED)
- pause() was called (state -> PAUSED)
- top-level agent has been destroyed (state -> FINISHED)
- exception occurred during event execution or agent destruction (state -> ERROR)
This method should never be called from the model execution thread!
Please note that by the time this method finishes, then engine may already be in PAUSED, FINISHED, or ERROR state.
false
). Puts the engine into RUNNING state and then starts the model
execution in a separate thread. The execution may discontinue due to the one of
the following reasons- there are no more events to execute (state -> FINISHED)
- stopTime is reached (state -> FINISHED)
- pause() was called (state -> PAUSED)
- top-level agent has been destroyed (state -> FINISHED)
- exception occurred during event execution or agent destruction (state -> ERROR)
This method should never be called from the model execution thread!
Please note that by the time this method finishes, then engine may already be in PAUSED, FINISHED, or ERROR state.
- Returns:
false
if the engine state does not allow running- See Also:
-
Engine.run()
@AnyLogicInternalCodegenAPI public void setDestroyed()
Marks this object as subject to destruction after the current step is finished.
Only this method should be called during a step, and not onDestroy()!
@AnyLogicInternalCodegenAPI public void onDestroy()
Must be called when the agent is dynamically disposed.
Deletes all event entries belonging to the agent from the engine
and unsubmits equations.
Don't call this method during step, use
Don't call this method during step, use
setDestroyed()
instead@AnyLogicInternalCodegenAPI public void onEngineFinished()
Is called by the engine when it finishes running and is intended to
wrap up a single simulation run (e.g. collect some results).
This is a user's extension point, by default does nothing.
Please note that Output elements which are calculated "On simulation end", are initialized after this method is called
This is a user's extension point, by default does nothing.
Please note that Output elements which are calculated "On simulation end", are initialized after this method is called
- Since:
- 8.0
@AnyLogicInternalCodegenAPI public void doFinish()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.
it may be removed/renamed in future. It is public due to technical reasons.
- Since:
- 8.0
@AnyLogicInternalCodegenAPI public SDIntegrationManager getIntegrationManager_xjal()
This method shouldn't be normally called by user.
Returns static integration manager defined in derived classes.
Returns static integration manager defined in derived classes.
- Returns:
- static integration manager defined in derived classes
@AnyLogicInternalCodegenAPI public int getDifferentialFlatEquationsCount_xjal()
This method shouldn't be normally called by user.
@AnyLogicInternalCodegenAPI public int getRuntimeAlgebraicFlatEquationsCount_xjal()
This method shouldn't be normally called by user.
@AnyLogicInternalCodegenAPI public int getRuntimeFormulaFlatEquationsCount_xjal()
This method shouldn't be normally called by user.
@AnyLogicInternalCodegenAPI public int getInitialAlgebraicFlatEquationsCount_xjal()
This method shouldn't be normally called by user.
@AnyLogicInternalCodegenAPI public int getInitialFormulaFlatEquationsCount_xjal()
This method shouldn't be normally called by user.
@AnyLogicInternalCodegenAPI public void getPhaseVector_xjal(double[] D, int idxD, double[] A, int idxA)
This method shouldn't be normally called by user.
Assigns given arrays with current variables values
Assigns given arrays with current variables values
- Parameters:
D
-A
-
@AnyLogicInternalCodegenAPI public void putPhaseVector_xjal(double[] D, int idxD, double[] A, int idxA)
This method shouldn't be normally called by user.
Assigns variables values from the given arrays
Assigns variables values from the given arrays
- Parameters:
D
-A
-
@AnyLogicInternalCodegenAPI public void getRightPart_xjal(double[] DR, int idxDR, double[] AR, int idxAR)
This method shouldn't be normally called by user.
Calculates right parts of differential equations and algebraic equations to the given arrays
Calculates right parts of differential equations and algebraic equations to the given arrays
- Parameters:
DR
-AR
-
@AnyLogicInternalCodegenAPI public void formulasExecute_xjal()
This method shouldn't be normally called by user.
Executes formulas defined in this agent.
Executes formulas defined in this agent.
@AnyLogicInternalCodegenAPI public void getPhaseVectorForInitialConditions_xjal(double[] A, int idxA)
This method shouldn't be normally called by user.
Assigns given arrays with current variables values (the function is used while solving initial conditions loops)
Assigns given arrays with current variables values (the function is used while solving initial conditions loops)
- Parameters:
A
-idxA
-
@AnyLogicInternalCodegenAPI public void putPhaseVectorForInitialConditions_xjal(double[] A, int idxA)
This method shouldn't be normally called by user.
Assigns variables values from the given arrays (the function is is used while solving initial conditions loops)
Assigns variables values from the given arrays (the function is is used while solving initial conditions loops)
- Parameters:
A
-idxA
-
@AnyLogicInternalCodegenAPI public void getRightPartForInitialConditions_xjal(double[] AR, int idxAR)
This method shouldn't be normally called by user.
Returns right part while solving algebraic loops in initial conditions
Returns right part while solving algebraic loops in initial conditions
@AnyLogicInternalCodegenAPI public void assignInitialConditions_xjal()
This method shouldn't be normally called by user.
This function assigns initial conditions for stocks and for flow aux variables
This function assigns initial conditions for stocks and for flow aux variables
@AnyLogicInternalCodegenAPI public void setupInitialConditions_xjal(Class<?> callerClass)
This method shouldn't be normally called by user.
@AnyLogicInternalAPI @Deprecated public final void restoreCollection_xjal(AgentList<?> collection)
Deprecated.
This method is internal and shouldn't be called by user.
it will be removed/renamed in future.
it will be removed/renamed in future.
@AnyLogicInternalCodegenAPI @Deprecated public void restoreOwner(Object owner)
Deprecated.
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
This method restores owner of this object
The method is used in snapshot saving/loading
- Specified by:
restoreOwner
in interfacecom.anylogic.engine.internal.Child
- Parameters:
owner
- owner of this object, usuallyAgent
,Experiment
orShapeGroup
public final <T extends AgentExtension> T tryExt(Class<T> c)
Returns an extension of given type only if this object already
contains such extension. Returns
null
when no such extension is defined- Parameters:
c
- extension type, use one ofEXT_*
constants or your custom extension class (if any is defined)- Returns:
- the extension object or
null
- See Also:
-
ext(Class)
public final <T extends AgentExtension> T ext(Class<T> c)
Returns an extension of given type. Creates extension if not yet created.
In some cases another method
Note that when you define your custom extension class you should register it.
This method may throw error if requested extension is incompatible with extensions this object already has (e.g. requested "Discrete space Agent" while the object already has "Continuous space Agent" extension).
Users shouldn't store the reference to the returned extension. Instead, they should store the reference to the underlying agent and, in case of any need, call this method to obtain the extension. (Technical info: the reason of such limitation is that the agent, at any time, may get another extension which could override some methods implemented in the previously added extension) .
tryExt(Class)
might be useful, e.g.
for testing whether object has some extension or not -- without any implicit creation.Note that when you define your custom extension class you should register it.
This method may throw error if requested extension is incompatible with extensions this object already has (e.g. requested "Discrete space Agent" while the object already has "Continuous space Agent" extension).
Users shouldn't store the reference to the returned extension. Instead, they should store the reference to the underlying agent and, in case of any need, call this method to obtain the extension. (Technical info: the reason of such limitation is that the agent, at any time, may get another extension which could override some methods implemented in the previously added extension) .
- Parameters:
c
- extension type, use one ofEXT_*
constants or your custom extension class (if any is defined)- Returns:
- the extension object, never
null
- See Also:
-
tryExt(Class)
@AnyLogicInternalAPI public void addExt_xjal(AgentExtension ext)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future
it may be removed/renamed in future
@AnyLogicInternalCodegenAPI public void setupExt_xjal(AgentExtension ext)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future
it may be removed/renamed in future
@AnyLogicInternalAPI public boolean removeExt_xjal(AgentExtension ext)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
This method removes the given extension if it is found in this agent and return
it may be removed/renamed in future.
This method removes the given extension if it is found in this agent and return
true
if it was successfully removed@AnyLogicLegacyAPI public boolean isAgent()
Returns
true
if this is at least an informational agent
(may be with or without spatial properties).
Returns false
if this is not an agent yet- Returns:
true
if this object is an agent- See Also:
-
getAgentSpaceType()
@AnyLogicLegacyAPI public boolean isEnvironment()
Returns
true
if this is an environment for agents (at least
informational environment).
Returns false
if this object doesn't define any environment yet- Returns:
true
if this object is an environment for agents- See Also:
-
getEnvironmentSpaceType()
@AnyLogicInternalCodegenAPI public void setAgentSpaceType(SpaceType spaceType)
Sets this agent to use the space of the given type.
Will throw an error if agent already has different space type
Will throw an error if agent already has different space type
- Parameters:
spaceType
- type of agent space type, one ofSPACE_*
constants
public SpaceType getAgentSpaceType()
Returns agent space type, if this is an agent and it has spatial information.
Returns
SPACE_UNDEFINED
if there is no agent spatial information
defined in this object- Returns:
- space type of agent, one of
SPACE_*
constants
public SpaceType getEnvironmentSpaceType()
Returns agent space type, if this is an environment and it has spatial information.
Returns
SPACE_UNDEFINED
if there is no environment spatial information
defined in this object- Returns:
- space type of environment, one of
SPACE_*
constants
@AnyLogicInternalCodegenAPI public void onBeforeStepEnvironment()
A callback that is called at the beginning of every step
before the agents are asked to perform any their step actions.
Should be defined in a subclass if an action is needed.
@AnyLogicInternalCodegenAPI public void onAfterStepEnvironment()
A callback that is called when at the end of every step
after the agents have performed all their step actions.
Should be defined in a subclass if an action is needed.
public Collection<Agent> agents()
Returns the collection of all agents registered with this environment.
You may iterate over that collection.
public Agent randomAgentInside()
Returns a randomly chosen agent in the environment or
null
if there are no agents- Returns:
- a randomly chosen agent in the environment, or
null
public Agent randomAgentInside(Random r)
Returns a randomly chosen agent in the environment or
null
if there are no agents.
This function uses the specified random number generator.- Parameters:
r
- the random number generator.- Returns:
- a randomly chosen agent in the environment, or
null
- Since:
- 8.0
public void disableSteps()
Disables time steps.
public void enableSteps(double stepDuration)
Enables discrete time steps with a given duration.
- Parameters:
stepDuration
- the duration of a step, normally 1
public boolean areStepsEnabled()
Tests if the time steps are enabled.
- Returns:
true
if the time steps are enabled,false
otherwise
public void deliverToAllAgentsInside(Object msg)
Immediately delivers a message to all agents in the environment.
- Parameters:
msg
- the message- Since:
- 7.0
public void deliverToRandomAgentInside(Object msg)
Immediately delivers a message to a random agent in the environment,
if there are any agents.
- Parameters:
msg
- the message- Since:
- 7.0
public void setNetworkUserDefined()
Sets network type to user-defined. As a result, a subsequent call of
applyNetwork() will do nothing. This is also a default network type.
public void setNetworkRandom(double connectionsPerAgent)
Sets network type to random with a given average number of connections per
agent. Call applyNetwork() to actually create network connections.
- Parameters:
connectionsPerAgent
- average number of connections per agent
public void setNetworkRingLattice(int connectionsPerAgent)
Sets network type to ring lattice. All agents are considered to be
in a ring in their natural order and each agent is connected to a
given number of closest neighbours. Call applyNetwork() to actually create
network connections.
- Parameters:
connectionsPerAgent
- number of connections per agent (even)
public void setNetworkSmallWorld(int connectionsPerAgent, double neighborLinkProbability)
Sets network type to "small world". Small world network can be obtained
from a ring lattice by rewiring some links to long-distant links.
Call applyNetwork() to actually create network connections.
- Parameters:
connectionsPerAgent
- number of connections per agent (even)neighborLinkProbability
- probability of connection to link neighbours
public void setNetworkScaleFree(int m)
Sets the network type to "scale free". Scale free network is constructed
according to Barabasi, A. L. and R. Albert. 1999. Emergence of scaling in
random networks. Science 286(5439): 509-512. Call applyNetwork() to actually
create network connections.
- Parameters:
m
- parameter of the scale free network (start number of hubs?)
public NetworkType getNetworkType()
Returns the network type. Note that this type has not necessarily been
applied.
- Returns:
- the network type
public double getNetworkConnectionsPerAgent()
Returns the average (or exact) number of connections per agent.
Applies to random, ring lattice and small world networks.
- Returns:
- the average (or exact) number of connections per agent
public double getNetworkNeighborLinkProbability()
Returns the probability of an agent connection to be a neighbour.
Applies to "small world" network.
- Returns:
- the probability of an agent connection to be a neighbour
public int getNetworkScaleFreeM()
Returns the M parameter of a scale free network.
Applies to "scale free" network.
- Returns:
- the M parameter of a scale free network
public void applyNetwork()
Discards all existing connections and establishes new connection
network according to the current network settings.
public void applyNetwork(Random r)
Discards all existing connections and establishes new connection
network according to the current network settings,
using the specified random number generator, if required by network type.
- Parameters:
r
- the random number generator.- Since:
- 8.0
public double spaceWidth()
Returns the width of environment continuous or discrete space.
- Returns:
- the width of environment space
public double spaceHeight()
Returns the height of environment continuous or discrete space.
- Returns:
- the height of environment space
public double spaceCellWidth()
Returns the width of the cell in discrete space.
- Returns:
- the width of the cell in discrete space
public double spaceCellHeight()
Returns the height of the cell in discrete space.
- Returns:
- the height of the cell in discrete space
public void setNetworkAllInRange(double connectionRange)
Sets network type to the one when agents are connected if the
distance between them is not longer that a given one. This network type
is only possible in continuous space. Call applyNetwork() to actually create
network connections.
- Parameters:
connectionRange
- the maximum distance between connected agents
In case of GIS space, measured in meters
public double getNetworkConnectionRange()
Returns the range of agent connections.
Applies to "all in range" network.
In case of GIS space, it is measured in meters
In case of GIS space, it is measured in meters
- Returns:
- the range of agent connections
public void setLayoutType(LayoutType type)
Sets the layout type. To apply the layout call applyLayout().
The default layout is LAYOUT_USER_DEFINED, i.e. arbitrary.
- Parameters:
type
- the new layout type
public LayoutType getLayoutType()
Returns the layout type. Note that this type has not necessarily been
applied.
- Returns:
- the layout type
public void applyLayout()
Rearranges agents in this environment according to the selected layout type.
- See Also:
-
setLayoutType(LayoutType)
public void setupSpace(double width, double height, double zHeight)
Sets the space to the given dimensions. The dimension
are used only when various layouts are applied and do not
restrict the location or movement of the agents.
This method should only be called when the environment is empty.
This method should only be called when the environment is empty.
- Parameters:
width
- the width of the spaceheight
- the height of the spacezHeight
- the height of the space along Z-axis
public void setupSpace(double width, double height)
Sets the space to the given dimensions. The dimension
are used only when various layouts are applied and do not
restrict the location or movement of the agents.
This method should only be called when the environment is empty.
This method should only be called when the environment is empty.
- Parameters:
width
- the width of the spaceheight
- the height of the space
public double spaceZHeight()
Returns the height of environment space along Z-axis.
- Returns:
- the z-height of environment space
public Point randomPointOfSpace()
Returns the random location inside within the space bounds of this environment
- Returns:
- the random location inside within the space bounds of this environment
public void setupSpace(double width, double height, int rows, int columns, NeighborhoodType neighborhoodType)
Sets the space type to discrete with the given dimensions and neighbourhood
type. A cell in such environment will have a size of (width/columns) by
(height/rows).
This method should only be called when the environment is empty.
This method should only be called when the environment is empty.
- Parameters:
width
- the width of the spaceheight
- the height of the spacerows
- the number of rows in the spacecolumns
- the number of columns in the spaceneighborhoodType
- the type of neighbourhood (Euclidean, Moore)
public int spaceRows()
Returns the number of rows in the space.
- Returns:
- the number of rows in the space
public int spaceColumns()
Returns the number of columns in the space.
- Returns:
- the number of columns in the space
public CellPosition randomEmptyCell()
Tries to find a pseudo-randomly located empty cell and return its row and column in
the array with two elements.
The current implementation is 100% fairly random.
The current implementation is 100% fairly random.
- Returns:
- the cell position (row and column) of the empty cell, or
null
public Agent getAgentAtCell(int r, int c)
Returns the agent located in the cell with a given row and column, or null.
- Parameters:
r
- the row of the cellc
- the column of the cell- Returns:
- the agent at (r,c) or null
public void setupSpace(AbstractShapeGISMap gisMap)
Sets the environment to have GIS space to be based on given
Throws error if environment has space type different from GIS.
gisMap
.
This method should only be called when the environment is empty.Throws error if environment has space type different from GIS.
- Parameters:
gisMap
- the GIS map to use in this environment, should not benull
public AbstractShapeGISMap getGISMap()
Returns
Throws error if environment has space type different from GIS.
AbstractShapeGISMap
object used in this GIS environment.Throws error if environment has space type different from GIS.
- Returns:
- GIS map object used in this environment
Note, that returned object has the base GIS map type and for additional services it needs to be casted toShapeGISMap
@AnyLogicInternalCodegenAPI public void onBeforeStep()
A callback that is called at the beginning of every step
in discrete time before onStep() of any agent is called.
Can be used as a preparatory action if two-phase steps.
Should be defined in a subclass if an action is needed.
@AnyLogicInternalCodegenAPI public void onStep()
A callback that is called at every step in discrete time
after onStep() of any agent is called.
Should be defined in a subclass if an action is needed.
@AnyLogicInternalCodegenAPI public void onReceive(Object msg, Agent sender)
A callback that is called when the agent receives a message
from another agent. Should be defined in a subclass if reaction is needed.
@AnyLogicInternalCodegenAPI public void onArrival()
A callback that is called when the agent arrives to the
target location after movement initiated by moveTo() in continuous 2D space.
Should be defined in a subclass if reaction is needed.
public void setEnvironment(Agent env)
Sets up time, space, etc. type for the agent. Must be called
during the startup of the agent and provide the environment
where the agent belongs to as a parameter.
- Parameters:
env
- the agent's environment
public Agent getEnvironment()
Returns the environment where this agent belongs to.
- Returns:
- the environment where this agent belongs to
public <T extends Agent> List<T> getConnections()
Returns a collection of agents connected to this agent (bi-directionally),
or empty collection if there have not been any connections yet. You should not
modify this collection.
- Returns:
- collection of connected agents, may be empty
@AnyLogicInternalAPI @Deprecated public void restoreConnections_xjal(List<?> connections)
Deprecated.
This method should not be called by user
This method restores connections of this agent
This method restores connections of this agent
- Parameters:
connections
- list of connections, may benull
public int getConnectionsNumber()
Returns the number of agents connected to this agent.
- Returns:
- the number of agents connected to this agent
public Agent getConnectedAgent(int index)
Returns the connected agent with a given index.
- Parameters:
index
- the index of connection- Returns:
- the connected agent with a given index
public Agent getRandomConnectedAgent()
Returns the randomly chosen connected agent.
- Returns:
- the connected agent
public boolean connectTo(Agent a)
Creates a bi-directional connection between this agent and a given
other agent. Raises error if you try to connect to itself. Does
nothing and returns
false
if agents are already connected.- Parameters:
a
- another agent- Returns:
true
if was not connected before,false
if was already connected
public boolean isConnectedTo(Agent a)
Tests if this agent is connected to a given other agent.
- Parameters:
a
- another agent- Returns:
true
if the agents are connected,false
otherwise
public boolean disconnectFrom(Agent a)
Disconnects this agent from another given agent.
- Parameters:
a
- another agent- Returns:
true
if the agents were connected,false
otherwise
public void disconnectFromAll()
Disconnects the agent from all other agents.
public void send(Object msg, Agent dest)
Sends a message to a given agent. The message will be delivered during
a separate event scheduled to occur in zero time after the current one.
If you are OK with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a messagedest
- the destination agent
public void sendToAll(Object msg)
Sends a message to all agents in the same environment this agent lives in.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one. If you are OK
with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a message- Since:
- 7.0
public void sendToRandom(Object msg)
Sends a message to a randomly chosen agent in the same environment this agent lives in.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one. If you are OK
with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a message- Since:
- 7.0
public void sendToAllConnected(Object msg)
Sends a message to all connected agents.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one. If you are OK
with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a message- Since:
- 7.0
public void sendToRandomConnected(Object msg)
Sends a message to a randomly chosen connected agent.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one. If you are OK
with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a message- Since:
- 7.0
public void sendToAllNeighbors(Object msg)
Sends a message to all neighbors. Available only if this
agent lives in discrete space environment.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one. If you are OK
with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a message- Since:
- 7.0
public void sendToRandomNeighbor(Object msg)
Sends a message to a randomly chosen neighbor. Available only if this
agent lives in discrete space environment.
The message will be delivered during a separate event
scheduled to occur in zero time after the current one. If you are OK
with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a message- Since:
- 7.0
public void send(Object msg, MessageDeliveryType mode)
Sends a message to an agent or a group of agents, as specified by the
mode parameter. The message will be delivered during a separate event
scheduled to occur in zero time after the current one. If you are OK
with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg
- a messagemode
- specifies the message sending mode (ALL, RANDOM, ...)
public void deliver(Object msg, Agent dest)
Delivers a message to a given agent immediately during this method call.
If you wish this to happen in a separate event, use send() method.
- Parameters:
msg
- a messagedest
- the destination agent
public void deliverToAllConnected(Object msg)
Delivers a message to all connected agents.
If you wish this to happen in a separate event, use
sendToAllConnected(Object)
method.- Parameters:
msg
- the message- Since:
- 7.0
public void deliverToRandomConnected(Object msg)
Delivers a message to a randomly chosen connected agent.
If you wish this to happen in a separate event, use
sendToRandomConnected(Object)
method.- Parameters:
msg
- a message- Since:
- 7.0
public void deliverToAllNeighbors(Object msg)
Delivers a message to all neighbors.
If you wish this to happen in a separate event, use
sendToAllNeighbors(Object)
method.- Parameters:
msg
- the message- Since:
- 7.0
public void deliverToRandomNeighbor(Object msg)
Delivers a message to a randomly chosen neighbor.
If you wish this to happen in a separate event, use
sendToRandomNeighbor(Object)
method.- Parameters:
msg
- a message- Since:
- 7.0
public void deliver(Object msg, MessageDeliveryType mode)
Delivers a message to an agent or a group of agents, as specified by the
mode parameter immediately during this method call.
If you wish this to happen in a separate event, use send() method.
- Parameters:
msg
- the messagemode
- specifies the message sending mode (ALL, RANDOM, ...)
public void receive(Object msg)
Immediately delivers a message to this agent. Sender is set to
null
.- Parameters:
msg
- the message
public String agentInfo()
public void setSpace(Agent space)
Sets the space for agent. Shouldn't be called for moving agents.
Coordinates and rotations are left "as is"
- Parameters:
space
- the agent representing space this agent will live in
public Agent getSpace()
Returns the agent representing space this agent lives in
- Returns:
- the agent representing space this agent lives in
@AnyLogicInternalCodegenAPI public double getPresentationScaleOnOwnerSpace()
Returns the scale of the agent presentation animation
on its space or
1.0
if space isn't defined- Returns:
- the scale of presentation animation on owner space
public double getX()
Returns the current (up-to-date) x coordinate of the agent in continuous space.
- Returns:
- the x coordinate in continuous space
In case of GIS environment this is the latitude of the current location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
public double getY()
Returns the current (up-to-date) y coordinate of the agent in continuous space.
- Returns:
- the y coordinate in continuous space
In case of GIS environment this is the longitude of the current location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
public Point getXYZ()
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space.
- Returns:
- the Point object containing coordinates in continuous space
In case of GIS environment the returnedpoint.x
is the latitude of the current location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90),point.y
is the longitude of the current location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180), andpoint.z
is set to0
public Point getXYZ(Point out)
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space.
- Parameters:
out
- the point object which will be used to write coordinates to (may benull
)- Returns:
- the Point object containing coordinates in continuous space
In case of GIS environment the returnedpoint.x
is the latitude of the current location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90),point.y
is the longitude of the current location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180), andpoint.z
is set to0
public Position getPosition()
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space and its orientation as well.
- Returns:
- the Position object containing coordinates and orientation
in continuous space
In case of GIS environment the returnedpoint.x
is the latitude of the current location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90),point.y
is the longitude of the current location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180), andpoint.z
is set to0
public Position getPosition(Position out)
Returns the current (up-to-date) x, y (and z in case of 3D space)
coordinate of the agent in continuous space and its orientation as well.
- Parameters:
out
- the Position object for the output, may benull
- Returns:
- the Position object containing coordinates and orientation
in continuous space
In case of GIS environment the returnedpoint.x
is the latitude of the current location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90),point.y
is the longitude of the current location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180), andpoint.z
is set to0
public double getRotation()
Returns the current rotation angle (in radians) of the agent in
continuous 3D space or GIS space. If rotation is not frozen (see
isAutomaticHorizontalRotation()
, setAutomaticHorizontalRotation(boolean)
),
the rotation changes each time the agent starts moving and also changes
multiple times during movement in GIS space.- Returns:
- the current rotation of the agent in radians (measured from animation point (1, 0), CW around (0, 0) point)
public void setRotation(double rotation)
Sets the rotation angle (in radians) of the agent animation in continuous 3D space or GIS space.
Depending on automatic rotation setting,
this rotation value may be overridden during the next call of moveTo() or
during current movement (if any exists).
- Parameters:
rotation
- the rotation angle of the agent in radians (measured from animation point (1, 0), CW around (0, 0) point)- See Also:
public void setAutomaticHorizontalRotation(boolean yes)
Tells agent to rotate automatically during movements.
- Parameters:
yes
-true
- agent will be rotated during movement,false
- rotation will not be changed- See Also:
-
setRotation(double)
public boolean isAutomaticHorizontalRotation()
Returns
true
if agent is set to be rotated during movement,
false
otherwise- Returns:
true
if agent is set to be rotated during movement- See Also:
public final <T extends Agent> T getNearestAgent(Iterable<T> agents)
Returns the nearest agent from the given collection
- Parameters:
agents
- the collection of agents- Returns:
- the nearest agent (never
this
one) ornull
if the collection is empty
public final <T extends Agent> T getNearestAgentByRoute(Iterable<T> agents)
Returns the nearest agent from the given collection. Distance between agents is calculated by route provider.
Only for agents in GIS environment.
- Parameters:
agents
- the collection of agents- Returns:
- the nearest agent (never
this
one) ornull
if the collection is empty
public void moveToNearestAgent(Iterable<? extends Agent> agents)
Starts movement to the nearest agent from the given collection.
Stops any current movement.
- Parameters:
agents
- the collection of agents
public void moveToNearestAgent(Iterable<? extends Agent> agents, double tripTime)
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.- Parameters:
agents
- the collection of agentstripTime
- the time of the movement trip
public final <T extends Agent> List<T> agentsInRange(Iterable<T> agents, double distance)
Returns the unsorted list of agents from the given collection which are within the given
distance
from this agent- Parameters:
agents
- the collection of agentsdistance
- the distance to search within- Returns:
- the list of agents within the given
distance
, unsorted
public final <T extends Agent> List<T> agentsInRange(Iterable<T> agents, double distanceInUnits, LengthUnits units)
Returns the unsorted list of agents from the given collection which are within the given
distance
from this agent- Parameters:
agents
- the collection of agentsdistanceInUnits
- the distance to search withinunits
- the units of length- Returns:
- the list of agents within the given
distance
, unsorted
public List<? extends Agent> agentsInRange(double distance)
Returns the unsorted list of agents (from the population
this agent lives in), which are within the given
distance
from this agent- Parameters:
distance
- the distance to search within- Returns:
- the list of agents within the given
distance
, unsorted
public List<? extends Agent> agentsInRange(double distanceInUnits, LengthUnits units)
Returns the unsorted list of agents (from the population
this agent lives in), which are within the given
distance
from this agent- Parameters:
distanceInUnits
- the distance to search withinunits
- the units of length- Returns:
- the list of agents within the given
distance
, unsorted
public void setXY(double x, double y)
Sets the coordinates of the agent location. Should only be
used to initialize the agent location. Assumes the agent is not moving.
- Parameters:
x
- the x coordinate of the location
In case of GIS environment this is the latitude of the location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the location
In case of GIS environment this is the longitude of the location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
public void setLatLon(double latitude, double longitude)
Sets the coordinates of the agent location. Should only be
used to initialize the agent location. Assumes the agent is not moving.
- Parameters:
latitude
- the latitude coordinate of the location measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)longitude
- the longitude coordinate of the location measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
@AnyLogicInternalAPI @Deprecated public boolean isSpacePositionSet_xjal()
Deprecated.
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
public double getTargetX()
Returns the x of the target location if moving, otherwise current x in
continuous 3D space or GIS space.
In case of GIS environment this is the latitude, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
In case of GIS environment this is the latitude, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
- Returns:
- the x of the target location if moving, otherwise current x
public double getTargetY()
Returns the y of the target location if moving, otherwise current y in
continuous 3D space or GIS space.
In case of GIS environment this is the longitude, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
In case of GIS environment this is the longitude, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
- Returns:
- the y of the target location if moving, otherwise current y
public double distanceTo(Agent other)
Calculates the distance from this agent to another one in continuous 3D space or GIS space.
In case of GIS environment returns distance measured in meters
In case of GIS environment returns distance measured in meters
- Parameters:
other
- another agent- Returns:
- the distance to the other agent
public double distanceTo(Agent other, LengthUnits units)
Calculates the distance from this agent to another one in continuous 3D space or GIS space.
In case of GIS environment returns distance measured in meters
In case of GIS environment returns distance measured in meters
- Parameters:
other
- another agentunits
- the units of length- Returns:
- the distance to the other agent
public double distanceByRoute(Agent other)
Calculates the distance from this agent to another one by route.
Only for agents in GIS environment.
Only for agents in GIS environment.
- Parameters:
other
- another agent- Returns:
- the distance to the other agent
public double distanceTo(double x, double y)
Calculates the distance from this agent to a given point in continuous 3D or GIS space.
- Parameters:
x
- the x coordinate of the point.
In case of GIS environment this is the latitude of the point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the point.
In case of GIS environment this is the longitude of the point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)- Returns:
- the distance to the point (x,y)
public double distanceTo(double x, double y, LengthUnits units)
Calculates the distance from this agent to a given point in continuous 3D or GIS space.
- Parameters:
x
- the x coordinate of the point.
In case of GIS environment this is the latitude of the point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the point.
In case of GIS environment this is the longitude of the point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)- Returns:
- the distance to the point (x,y)
public void jumpTo(double x, double y)
Instantly moves the agent to a given location in continuous 3D or GIS space.
Terminates any movement.
Doesn't call "on arrival" code
Doesn't call "on arrival" code
- Parameters:
x
- the x coordinate of the new location.
In case of GIS environment this is the latitude of the new location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the new location
In case of GIS environment this is the longitude of the new location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
public void moveToStraight(double x, double y)
Starts straight movement (ignoring network/routes) 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.
- Parameters:
x
- the x coordinate of the point.
In case of GIS environment this is the latitude of the point, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the point.
In case of GIS environment this is the longitude of the point, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)- Since:
- 7.1.1
public void moveToStraight(Point location)
Starts straight movement (ignoring network/routes) 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.
- Parameters:
location
- the target location- Since:
- 7.1
public void moveToStraight(Agent agent)
Starts straight movement (ignoring network/routes) in the direction of the given agent.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
agent
-- Since:
- 7.1.1
public void moveToStraightInTime(Point location, double tripTime)
Starts straight movement (ignoring network/routes) 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.
- Parameters:
location
- the target locationtripTime
- the time of the movement trip- Since:
- 7.1
public void moveToStraightInTime(Point location, double tripTime, TimeUnits units)
Starts straight movement (ignoring network/routes) 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.
- Parameters:
location
- the target locationtripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public void moveTo(double x, double y)
Starts movement in the direction of the given target location in continuous 3D or GIS space.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
x
- the x coordinate of the target location.
In case of GIS environment this is the latitude of the target location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the target location
In case of GIS environment this is the longitude of the target location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
public void moveToInTime(double x, double y, double tripTime)
Starts movement in the direction of the given target location in continuous 3D or GIS space.
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.
- Parameters:
x
- the x coordinate of the target location.
In case of GIS environment this is the longitude of the target location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)tripTime
- the time of the movement trip In case of GIS environment this is the latitude of the target location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)y
- the y coordinate of the target location
public void moveToInTime(double x, double y, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location in continuous 3D or GIS space.
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.
- Parameters:
x
- the x coordinate of the target location.
In case of GIS environment this is the latitude of the target location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)y
- the y coordinate of the target location
In case of GIS environment this is the longitude of the target location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)tripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public boolean isMoving()
Tests if the agent is currently moving in continuous 3D space or GIS space.
- Returns:
true
if the agent is moving,false
otherwise
public void stop()
Stops movement in continuous 3D or GIS space.
@AnyLogicLegacyAPI @Deprecated public void setVelocity(double v)
Deprecated.
this function is deprecated since AnyLogic 7.1. Please use
setSpeed(double, SpeedUnits)
insteadChanges speed of the agent in continuous space
(measured in pixels per model-time-unit, and in GIS-based environments - 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.
- Parameters:
v
- the new speed
@AnyLogicLegacyAPI @Deprecated public double getVelocity()
Deprecated.
this function is deprecated since AnyLogic 7.1. Please use
getSpeed(SpeedUnits)
insteadReturns the current value of the agent speed in continuous space.
(measured in pixels per model-time-unit, and in GIS-based environments - in m/s).
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.
- Returns:
- the current value of agent speed
public void setSpeed(double speedInMPS)
Changes speed of the agent in continuous/GIS space
(measured in meters per second).
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.
- Parameters:
speedInMPS
- the new speed, meters per second- Since:
- 7.1
public void setSpeed(double speedInUnits, SpeedUnits units)
Changes speed of the agent in continuous/GIS space
(measured in the given units).
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.
- Parameters:
v
- the new speedunits
- the units of speed- Since:
- 7.1
public double getSpeed(SpeedUnits units)
Returns the current value of the agent speed in continuous/GIS space.
(measured in the given units).
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.
- Parameters:
units
- the units of speed- Returns:
- the current value of agent speed
- Since:
- 7.1
public double getSpeed()
Returns the current value of the agent speed in continuous/GIS space.
(measured in meters per second).
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.
- Returns:
- the current value of agent speed, meters per second
- Since:
- 7.1
public final double timeToArrival()
Returns the time to arrival to the target location in continuous 2D space
or GIS space, in model-time units.
If the agent is not moving, returns 0.
If the agent is not moving, returns 0.
- Returns:
- the time to arrival to the target location, or 0
public final double timeToArrival(TimeUnits units)
Returns the time to arrival to the target location in continuous 2D space
or GIS space, in model-time units.
If the agent is not moving, returns 0.
If the agent is not moving, returns 0.
- Returns:
- the time to arrival to the target location, or 0
- Since:
- 7.1
public Level getLevel()
Returns the level this agent lives in, actual for agents in continuous space.
- Returns:
- the level this agent lives in
public void setLevel(Level level)
Sets this agent to live in the level, actual for agents in continuous space.
- Parameters:
level
- the level this agent will live in
public INetwork getNetwork()
Returns the network this agent lives in, actual for agents in continuous space.
- Returns:
- the network this agent lives in
public void setNetwork(INetwork network)
Sets this agent to live in the network, actual for agents in continuous and GIS space.
- Parameters:
network
- implementation ofcom.anylogic.engine.markup.INetwork
interface
public INode getNetworkNode()
Returns the network node this agent currently is located in, actual for agents in continuous space.
- Returns:
- the network node this agent currently is located in
@Deprecated @AnyLogicInternalAPI public void setNetworkNode(INode node, Point position)
Deprecated.
Sets the current network location for the agent
- Parameters:
node
- the network nodeposition
- (optional) location within node, may benull
@AnyLogicLegacyAPI public void setNetworkNode(INode node)
Sets the current network location for the agent
- Parameters:
node
- the network node
@AnyLogicLegacyAPI public void setNetworkNode(Attractor attractor)
Sets the current network location for the agent
- Parameters:
attractor
- the attractor
public double getZ()
Returns the current (up-to-date) z coordinate of the agent in continuous space.
- Returns:
- the z coordinate in continuous space
public double getTargetZ()
Returns the z of the target location if moving, otherwise current z in
continuous space.
- Returns:
- the z of the target location if moving, otherwise current z
public void setVerticalRotation(double rotation)
Sets the vertical rotation (angle in radians), along Z-axis of the agent animation in 3D
space. Depending on automatic vertical rotation setting,
this rotation value may be overridden during the next call of moveTo() or during current
movement (if any exists) along path/polyline.
- Parameters:
rotation
- the vertical rotation angle of the agent in radians- See Also:
public double getVerticalRotation()
Returns the current vertical rotation angle of the agent in
3D space. If automatic vertical rotation mode is set,
the rotation changes each time the agent starts moving and also changes
multiple times during movement along polyline.
- Returns:
- the current rotation of the agent in radians around Y axis (CW from +Z to +X)
public void setAutomaticVerticalRotation(boolean yes)
Tells agent to rotate automatically (in vertical direction, along Z-axis)
during movements in 3D.
Has no effect if
Has no effect if
isAutomaticHorizontalRotation()
is false
- Parameters:
yes
-true
- agent will be rotated during movement (e.g. box travelling on conveyor slope),false
- rotation will not be changed (e.g. passenger going upstairs)- See Also:
-
setVerticalRotation(double)
public boolean isAutomaticVerticalRotation()
Returns
The returned value has no effect if
true
if agent is set to be rotated (in vertical direction,
along Z-axis) during movement in 3D, false
otherwise.The returned value has no effect if
isAutomaticHorizontalRotation()
is false
- Returns:
true
if agent is set to be rotated during movement (e.g. box travelling on conveyor slope),false
- rotation will not be changed (e.g. passenger going upstairs)- See Also:
public void setXYZ(Point location)
This method is used for initialization only, for dynamic
assignment, please use
Sets the coordinates of the agent location in continuous 3D space.
Should only be used to initialize the agent location. Assumes the agent is not moving. If the agent is not in continuous 3D space, does nothing.
jumpTo(double, double)
.Sets the coordinates of the agent location in continuous 3D space.
Should only be used to initialize the agent location. Assumes the agent is not moving. If the agent is not in continuous 3D space, does nothing.
- Parameters:
location
- the location
public void setPosition(Position position)
This method is used for initialization only, for dynamic
assignment, please use
Sets the coordinates and orientation of the agent location.
Should only be used to initialize the agent location. Assumes the agent is not moving.
jumpTo(double, double)
.Sets the coordinates and orientation of the agent location.
Should only be used to initialize the agent location. Assumes the agent is not moving.
- Parameters:
position
- the location and orientation
public void setLocation(Point point)
This method is used for initialization only, for dynamic
assignment, please use
Sets the coordinates of the agent location.
Should only be used to initialize the agent location. Assumes the agent is not moving.
jumpTo(Point)
.Sets the coordinates of the agent location.
Should only be used to initialize the agent location. Assumes the agent is not moving.
- Parameters:
point
- the location
public void setLocation(INode node)
This method is used for initialization only, for dynamic
assignment, please use
Sets the coordinates of the agent location and puts it into network node (if network is defined).
Should only be used to initialize the agent location. Assumes the agent is not moving.
jumpTo(INode)
.Sets the coordinates of the agent location and puts it into network node (if network is defined).
Should only be used to initialize the agent location. Assumes the agent is not moving.
- Parameters:
node
- the location
@AnyLogicInternalCodegenAPI public void setLocationRandomInside(INode node)
This method is used for initialization only, for dynamic
assignment, please use
Sets the coordinates of the agent location to the randomly chosen point inside the given node and puts it into network node (if network is defined).
Should only be used to initialize the agent location. Assumes the agent is not moving.
jumpTo(INode)
.Sets the coordinates of the agent location to the randomly chosen point inside the given node and puts it into network node (if network is defined).
Should only be used to initialize the agent location. Assumes the agent is not moving.
- Parameters:
node
- the location- Since:
- 8.6.0
public void setLocation(Attractor attractor)
Sets the current network location for the agent
- Parameters:
attractor
- the attractor
public void setXYZ(double x, double y, double z)
This method is used for initialization only, for dynamic
assignment, please use
Sets the coordinates of the agent location in continuous 3D space.
Should only be used to initialize the agent location. Assumes the agent is not moving. If the agent is not in continuous 3D space, does nothing.
jumpTo(double, double)
.Sets the coordinates of the agent location in continuous 3D space.
Should only be used to initialize the agent location. Assumes the agent is not moving. If the agent is not in continuous 3D space, does nothing.
- Parameters:
x
- the x coordinate of the locationy
- the y coordinate of the locationz
- the z coordinate of the location
public void setLocation(Agent agent)
Takes position of given agent and sets it to this agent.
- Parameters:
agent
- the agent
public void jumpTo(Point location)
Instantly moves the agent to a given location without.
Terminates any movement.
Doesn't call "on arrival" code
Doesn't call "on arrival" code
- Parameters:
location
- the new location
public void jumpTo(INode node)
Instantly moves the agent to a given network location.
Terminates any movement.
Doesn't call "on arrival" code
Doesn't call "on arrival" code
- Parameters:
node
- the network node.
public void jumpTo(INode node, Point location)
Instantly moves the agent to a given network location.
Terminates any movement.
Doesn't call "on arrival" code
Doesn't call "on arrival" code
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
public void jumpTo(double x, double y, double z)
Instantly moves the agent to a given location.
Terminates any movement.
Doesn't call "on arrival" code
Doesn't call "on arrival" code
- Parameters:
x
- the x coordinate of the new locationy
- the y coordinate of the new locationz
- the z coordinate of the new location
public void jumpTo(String geographicPlace)
Finds first geographic point on the Earth and calls method jumpTo(latitude, longitude) with coordinates of the found point
- Parameters:
geographicPlace
- the name of place
public void moveTo(Point location)
Starts movement in the direction of the given target location in continuous 3D.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
location
- the target location
public void moveTo(Agent agent)
Starts movement in the direction of the given agent.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
agent
-
public void moveToInTime(Agent agent, double tripTime)
Starts movement in the direction of the given agent.
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.
- Parameters:
agent
- the agenttripTime
- the time of the movement trip
public void moveToInTime(Agent agent, double tripTime, TimeUnits units)
Starts movement in the direction of the given agent.
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
."On arrival" code is executed when movement is finished.
- Parameters:
agent
- the agenttripTime
- the time of the movement tripunits
- the units of time
public void moveTo(String geographicPlace)
Finds first geographic point on the Earth and calls method moveTo(latitude, longitude) with coordinates of the found point
- Parameters:
geographicPlace
- the name of place
public 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
"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.
- Parameters:
location
- the target locationtripTime
- the time of the movement trip
public 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
"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.
- Parameters:
location
- the target locationtripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public void moveTo(INode node)
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.
- Parameters:
node
- the network node.
public void moveTo(INode node, Point location)
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.
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
public void moveToInTime(INode node, double tripTime)
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.
- Parameters:
node
- the network node.tripTime
- the time of the movement trip
public void moveToInTime(INode node, double tripTime, TimeUnits units)
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.
- Parameters:
node
- the network node.tripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public 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
"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.
- 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)
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.
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
tripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public void moveTo(Attractor attractor)
Starts movement to the given attractor.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
attractor
- the attractor.
public void moveToInTime(Attractor attractor, double tripTime)
Starts movement to the given attractor.
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.
- Parameters:
attractor
- the attractor.tripTime
- the time of the movement trip
public void moveToInTime(Attractor attractor, double tripTime, TimeUnits units)
Starts movement to the given attractor.
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.
- Parameters:
attractor
- the attractor.tripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public void moveToStraight(double x, double y, double z)
Starts straight movement (ignoring network) 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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target location
public void moveToStraightInTime(double x, double y, double z, double tripTime)
Starts straight movement (ignoring network) 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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target locationtripTime
- the time of the movement trip- Since:
- 7.1
public void moveToStraightInTime(double x, double y, double z, double tripTime, TimeUnits units)
Starts straight movement (ignoring network) 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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target locationtripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public void moveTo(double x, double y, double z)
Starts movement in the direction of the given target location in continuous 3D.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target location
public void moveToInTime(double x, double y, double z, double tripTime)
Starts movement in the direction of the given target location in continuous 3D.
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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target locationtripTime
- the time of the movement trip
public void moveToInTime(double x, double y, double z, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location in continuous 3D.
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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target locationtripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
@AnyLogicLegacyAPI public void moveTo(double x, double y, Path2D path)
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
Z coordinate of target (and path points) is the same as the current
agent's Z coordinate.
If the agent is currently not on the path, it will first move to
the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationpath
- the polyline along which the agent will move
@AnyLogicLegacyAPI public void moveToInTime(double x, double y, Path2D path, double tripTime)
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
Z coordinate of target (and path points) is the same as the current
agent's Z coordinate.
If the agent is currently not on the path, it will first move to
the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationpath
- the polyline along which the agent will movetripTime
- the time of the movement trip
@AnyLogicLegacyAPI public void moveToInTime(double x, double y, Path2D path, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location in
continuous 3D space along a given path.
Z coordinate of target (and path points) is the same as the current
agent's Z coordinate.
If the agent is currently not on the path, it will first move to
the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationpath
- the polyline along which the agent will movetripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
@AnyLogicLegacyAPI public void moveTo(Point location, Path3D path)
Starts movement in the direction of the given target location in
continuous 3D space along a given path. If the agent is currently
not on the path, it will first move to the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
location
- the target locationpath
- the polyline along which the agent will move
@AnyLogicLegacyAPI public void moveToInTime(Point location, Path3D path, double tripTime)
Starts movement in the direction of the given target location in
continuous 3D space along a given path. If the agent is currently
not on the path, it will first move to the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
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.
- Parameters:
location
- the target locationpath
- the polyline along which the agent will movetripTime
- the time of the movement trip
@AnyLogicLegacyAPI public void moveToInTime(Point location, Path3D path, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location in
continuous 3D space along a given path. If the agent is currently
not on the path, it will first move to the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
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.
- Parameters:
location
- the target locationpath
- the polyline along which the agent will movetripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
@AnyLogicLegacyAPI public void moveTo(double x, double y, double z, Path3D path)
Starts movement in the direction of the given target location in
continuous 3D space along a given path. If the agent is currently
not on the path, it will first move to the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target locationpath
- the polyline along which the agent will move
@AnyLogicLegacyAPI public void moveToInTime(double x, double y, double z, Path3D path, double tripTime)
Starts movement in the direction of the given target location in
continuous 3D space along a given path. If the agent is currently
not on the path, it will first move to the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target locationpath
- the polyline along which the agent will movetripTime
- the time of the movement trip
@AnyLogicLegacyAPI public void moveToInTime(double x, double y, double z, Path3D path, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location in
continuous 3D space along a given path. If the agent is currently
not on the path, it will first move to the closest point on the path.
If the target is not on the path, the agent will move along the path
to the point closest to the target, and then move to the target.
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.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationz
- the z coordinate of the target locationpath
- the polyline along which the agent will movetripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
public IRouteProvider getRouteProvider()
Returns the provider of routes for agent movement
- Returns:
- the route provider
- See Also:
-
IRouteProvider
public void setRouteProvider(IRouteProvider routeProvider)
Stops agent if it is moving. Sets the route provider for agent movement.
- Parameters:
routeProvider
- the route provider- See Also:
-
IRouteProvider
public double distanceTo(double x, double y, double z)
Calculates the distance from this agent to a given point in continuous space.
- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the pointz
- the z coordinate of the point- Returns:
- the distance to the point (x,y,z)
public double distanceTo(double x, double y, double z, LengthUnits units)
Calculates the distance from this agent to a given point in continuous space.
- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the pointz
- the z coordinate of the pointunits
- the units of length- Returns:
- the distance to the point (x,y,z)
public double distanceTo(Point p)
Calculates the distance from this agent to a given point.
- Parameters:
p
- the point- Returns:
- the distance to the point
public double distanceTo(Point p, LengthUnits units)
Calculates the distance from this agent to a given point.
- Parameters:
p
- the pointunits
- the units of length- Returns:
- the distance to the point
@Deprecated public double getLat()
Deprecated.
use getLatitude()
Returns the current (up-to-date) latitude of the agent in continuous GIS space.
- Returns:
- the latitude of the current location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
@Deprecated public double getLon()
Deprecated.
use getLongitude()
Returns the current (up-to-date) longitude of the agent in continuous GIS space.
- Returns:
- the longitude of the current location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
public double getLatitude()
Returns the current (up-to-date) latitude of the agent in continuous GIS space.
- Returns:
- the latitude of the current location, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
public double getLongitude()
Returns the current (up-to-date) longitude of the agent in continuous GIS space.
- Returns:
- the longitude of the current location, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
public double getTargetLon()
Returns the longitude of the target location if moving, otherwise current longitude in
GIS space, measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
- Returns:
- the longitude of the target location if moving, otherwise current longitude
public double getTargetLat()
Returns the latitude of the target location if moving, otherwise current latitude in
GIS space, measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
- Returns:
- the latitude of the target location if moving, otherwise current latitude
public double getGISHeading()
Returns current heading angle (measured in radians CW,
starting from North direction) of agent moving in GIS space.
- Returns:
- the current GIS heading angle (measured in radians CW, starting from North direction)
public int getR()
Returns the row of the agent's cell.
- Returns:
- the row of the agent's cell
public int getC()
Returns the column of the agent's cell.
- Returns:
- the column of the agent's cell
public void setCell(int r, int c)
Puts the agent into a given cell. Should only be used to initialize
the agent location. Agent is put into the given cell of discrete 2D environment
(it is assumed the cell is empty, and the
agent has not yet been assigned a cell).
- Parameters:
r
- the row of the cellc
- the column of the cell
public void jumpToCell(int r, int c)
Moves the agent into a cell with the given row and column.
Raises error if that cell is nonempty.
- Parameters:
r
- the row of the new cellc
- the column of the new cell
public void moveToNextCell(CellDirection dir)
Moves the agent to an adjacent cell in a given direction.
- Parameters:
dir
- the direction (NORTH, SOUTH, ..., NORTHEAST, ...)
public boolean isNextCellInsideSpace(CellDirection dir)
Returns
Returns
true
if there is an adjacent cell in a given direction.
Note that the cell may be occupied by some agent.Returns
false
if going in a given direction will push agent outside
the discrete space grid (e.g. moveToNextCell(CellDirection)
will throw error in such case)- Parameters:
dir
- the direction (NORTH, SOUTH, ..., NORTHEAST, ...)- Returns:
- whether the adjacent cell in the given direction exists (
true
) in the discrete space grid, or not (false
)
public void swapWithCell(int r, int c)
Swaps this agent with an agent at the cell with the given row and column.
That cell may be empty - is this case simply moves the agent there.
- Parameters:
r
- the row of the new cellc
- the column of the new cell
public void swapWithNextCell(CellDirection dir)
Swaps the agent with an agent at the adjacent cell in a given direction.
- Parameters:
dir
- the direction (NORTH, SOUTH, ..., NORTHEAST, ...)
public void swapWithAgent(Agent anotherAgent)
Swaps the cell location of this agent with another agent.
- Parameters:
anotherAgent
- agent to swap cell location with. Should be located on the same environment
public boolean jumpToRandomEmptyCell()
Finds a random empty cell and places the agent there. If there is no empty cell,
does nothing.
- Returns:
true
if empty cell was found and agent was moved there, otherwisefalse
public Agent getAgentNextToMe(CellDirection dir)
Returns the agent next to this agent in a given direction, if any.
- Parameters:
dir
- the direction (NORTH, SOUTH, ..., NORTHEAST, ...)- Returns:
- the agent next to this agent in a given direction, or null
public Agent[] getNeighbors()
Returns the array of neighbor agents, subject to the current
neighborhood type (Euclidean - {N,S,E,W}, Moore - also {..,NW,NW,SE,SW})
- Returns:
- the array of neighbor agents, or null if there are none
@AnyLogicInternalCodegenAPI public void onEnterFlowchartBlock(Agent oldBlock, Agent block)
A callback that is called when the agent enters flowchart block (being an 'entity')
@AnyLogicInternalCodegenAPI public void onExitFlowchartBlock(Agent block)
A callback that is called when the agent exits flowchart block (being an 'entity')
@AnyLogicInternalCodegenAPI public void onSeizeResource(Agent unit)
A callback that is called when the agent seizes resource
@AnyLogicInternalCodegenAPI public void onReleaseResource(Agent unit)
A callback that is called when the agent releases resource
public void highlight(boolean yes)
Turns on/off highlighting of this agent animation.
The behavior of the function is specific and usually depends on
the library which drives this agent
- Parameters:
yes
-true
for highlighted status,false
for regular
public double getFlowchartEntryTime()
Returns the time the entity has entered the first block in the flowchart,
or
Double.NaN
if this agent hasn't yet visited any flowchart- Returns:
- time or
Double.NaN
public void addAgentToContents(Agent agent)
Adds a given agent to the contents of this agent.
- Parameters:
agent
- the agent to add
@Deprecated public void addEntityToContents(Agent agent)
Deprecated.
please use
addAgentToContents(Agent)
public boolean removeAgentFromContents(Agent agent)
Removes the given agent from the contents of this agent.
- Parameters:
agent
- the agent to remove- Returns:
- returns
true
ifagent
was removed,false
if this agent didn't contain the specifiedagent
@Deprecated public boolean removeEntityFromContents(Agent agent)
Deprecated.
please use
removeAgentFromContents(Agent)
public double getLength()
Returns the length of the agent (measured in meters) - used by conveyors and
other blocks which require it during processing.
- Returns:
- the length of the agent
public double getLength(LengthUnits units)
Returns the length of the agent (measured in the given units) - used by conveyors and
other blocks which require it during processing.
- Parameters:
units
- the units of length- Returns:
- the length of the agent
- Since:
- 7.1
public void setLength(double lengthInMeters)
Sets the length of the agent. This function only affects agents driven by Material Handling
and Process Modeling libraries (e.g. on conveyors). For pedestrians, cars, and other
specific agents, please use custom setter of the agent extension, e.g., setDiameter.
- Parameters:
lengthInMeters
- the length, measured in the meters
public void setLength(double lengthInUnits, LengthUnits units)
Sets the length of the agent. This function only affects agents driven by Material Handling
and Process Modeling libraries (e.g. on conveyors). For pedestrians, cars, and other
specific agents, please use custom setter of the agent extension, e.g., setDiameter.
- Parameters:
length
- the length, measured in the given unitsunits
- the units of length- Since:
- 7.1
public double getWidth()
Returns the width of the agent (measured in meters) - used by conveyors and
other blocks which require it during processing.
- Returns:
- the width of the agent
- Since:
- 8.2
public double getWidth(LengthUnits units)
Returns the width of the agent (measured in the given units) - used by conveyors and
other blocks which require it during processing.
- Parameters:
units
- the units of length- Returns:
- the width of the agent
- Since:
- 8.2
public void setWidth(double widthInMeters)
Sets the width of the agent
- Parameters:
widthInMeters
- the width, measured in the meters- Since:
- 8.2
public void setWidth(double widthInUnits, LengthUnits units)
Sets the width of the agent
- Parameters:
widthInUnits
- the width, measured in the given unitsunits
- the units of length- Since:
- 8.2
public double getHeight()
Returns the height of the agent (measured in meters) - used by conveyors and
other blocks which require it during processing.
- Returns:
- the height of the agent
- Since:
- 8.2
public double getHeight(LengthUnits units)
Returns the height of the agent (measured in the given units) - used by conveyors and
other blocks which require it during processing.
- Parameters:
units
- the units of length- Returns:
- the height of the agent
- Since:
- 8.2
public void setHeight(double heightInMeters)
Sets the height of the agent
- Parameters:
heightInMeters
- the height, measured in the meters- Since:
- 8.2
public void setHeight(double heightInUnits, LengthUnits units)
Sets the height of the agent
- Parameters:
heightInUnits
- the height, measured in the given unitsunits
- the units of length- Since:
- 8.2
public void setDimensions(double lengthInMeters, double widthInMeters, double heightInMeters)
Sets the length, width, height of the agent
- Parameters:
lengthInMeters
- the length, measured in the meterswidthInMeters
- the width, measured in the metersheightInMeters
- the height, measured in the meters- Since:
- 8.3
public void setDimensions(double lengthInUnits, double widthInUnits, double heightInUnits, LengthUnits units)
Sets the length, width, height of the agent
- Parameters:
lengthInUnits
- the length, measured in the given unitswidthInUnits
- the width, measured in the given unitsheightInUnits
- the height, measured in the given unitsunits
- the units of length- Since:
- 8.3
public <T extends Agent> List<T> contents()
public <T extends Agent> List<T> resourceUnits()
Returns the list of resource units seized by the entity, or empty list
if there are none.
- Returns:
- the list of resource units seized by the entity, never returns
null
public <T extends Agent> List<T> resourceUnitsOfSeize(Agent seize)
Return resource units currently seized by this entity
in the given
Seize
block- Parameters:
seize
-Seize
block- Returns:
- resource units currently seized by this entity
public <T extends Agent> List<T> resourceUnitsOfPool(Agent pool)
Returns resource units currently seized by this entity
from the given
ResourcePool
block- Parameters:
pool
-ResourcePool
block- Returns:
- resource units currently seized by this entity
public Agent resourceUnitOfPool(Agent pool)
Returns the first occurrence of resource unit of a given pool
among the seized resource units, or
null
if not found.- Parameters:
pool
- the pool of the unit (ResourcePool block)- Returns:
- the seized resource unit from the given pool, if found
public FlowchartBlock currentBlock()
Returns the current flowchart block this agent
is being processed in. This method is designed for
agents which act as 'entities' in process flowchart diagrams.
- Returns:
- the current flowchart block containing this agent
or
null
if the agent isn't in flowchart
public double getBlockEnterTime()
Returns the time this agent entered its current flowchart block.
- Returns:
- the time this agent entered its current flowchart block or
Double.NaN
if this agent isn't in the flowchart
public void setColor(Color color)
Sets the color of the item's default animation shape.
For custom agent type animation shapes, please use setFillColor and other setters.
For custom agent type animation shapes, please use setFillColor and other setters.
- Parameters:
color
- the new color of the default shape
public Color getColor()
Returns the color of the item's default animation shape.
The color may be set by using
setColor(Color)
or otherwise it will be chosen randomly.- Returns:
- the color of the item default shape
@AnyLogicInternalCodegenAPI public ShapeTopLevelPresentationGroup getPresentationShape()
- Overrides:
getPresentationShape
in classPresentable
@AnyLogicInternalAPI public LinkToAgentCollection<? extends Agent,? extends Agent> getLinkToAgentStandard_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
addAgentToContents(Agent)