AnyLogic AnyLogic
Expand
Font size
All Superinterfaces:
AgentExtension, java.io.Serializable

public interface ExtRootModelAgent
extends AgentExtension
This extension may be defined only in the top-level agent of the model. It owns 'default population' which e.g. takes agents created dynamically in flowcharts.
Author:
AnyLogic North America, LLC https://anylogic.com

Field Summary

Fields inherited from interface com.anylogic.engine.AgentExtension

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

Method Summary

All Methods Instance Methods Abstract Methods Default Methods 
void addDestroyListener​(AgentDestroyListener listener)
Adds listener for top-level agent destroy.
<T> T getCustomObject​(java.lang.Object requestor)
Returns custom object previously set by setCustomObject(Object, Object)
default <T> T getCustomObject​(java.lang.Object requestor, java.util.function.Supplier<T> initializer)
Returns custom object previously set by setCustomObject(Object, Object) or creates a new one using the given initializer
AgentList<Agent> getDefaultPopulation()
Returns 'default population' which e.g. takes agents created dynamically in flowcharts.
void removeDestroyListener​(AgentDestroyListener listener)
Adds listener for top-level agent destroy
<T> T setCustomObject​(java.lang.Object requestor, T object)
Registers some custom object for the given requestor Throws error if requestor is null
Modifier and Type Method Description

Methods inherited from interface com.anylogic.engine.AgentExtension

getAgent, next_xjal, onDestroy, onExtensionRemoved, priority, setNext_xjal, supportsInterface_xjal

Method Detail

getDefaultPopulation

AgentList<Agent> getDefaultPopulation()
Returns 'default population' which e.g. takes agents created dynamically in flowcharts.
Returns:
default population of top-level agent of the model

addDestroyListener

@AnyLogicInternalAPI
void addDestroyListener​(AgentDestroyListener listener)
Adds listener for top-level agent destroy. Listener should be Serializable

removeDestroyListener

@AnyLogicInternalAPI
void removeDestroyListener​(AgentDestroyListener listener)
Adds listener for top-level agent destroy

getCustomObject

@AnyLogicInternalAPI
<T> T getCustomObject​(java.lang.Object requestor)
Returns custom object previously set by setCustomObject(Object, Object)
Parameters:
requestor - any not null object, usually some agent or class, should be Serializable
Returns:
custom object for the given requestor

getCustomObject

@AnyLogicInternalAPI
default <T> T getCustomObject​(java.lang.Object requestor,
                              java.util.function.Supplier<T> initializer)
Returns custom object previously set by setCustomObject(Object, Object) or creates a new one using the given initializer
Parameters:
requestor - any not null object, usually some agent or class, should be Serializable
initializer - initializer, used when custom object is not registered. Initializer should return Serializable object
Returns:
custom object for the given requestor

setCustomObject

@AnyLogicInternalAPI
<T> T setCustomObject​(java.lang.Object requestor,
                      T object)
Registers some custom object for the given requestor Throws error if requestor is null
Parameters:
requestor - any not null object, usually some agent or class, should be Serializable
object - custom object for the given requestor, use null to unregister custom object of requestor, should be Serializable
Returns:
object previously registered for requestor or otherwise null
How can we improve this article?