AnyLogic
Expand
Font size
All Superinterfaces:
AgentExtension, 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

Method Summary

Modifier and TypeMethodDescription
voidaddDestroyListener(AgentDestroyListener listener)
Adds listener for top-level agent destroy.
<T> TgetCustomObject(Object requestor)
Returns custom object previously set by setCustomObject(Object, Object)
default <T> TgetCustomObject(Object requestor, 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.
voidremoveDestroyListener(AgentDestroyListener listener)
Adds listener for top-level agent destroy
<T> TsetCustomObject(Object requestor, T object)
Registers some custom object for the given requestor Throws error if requestor is null

Methods inherited from interface com.anylogic.engine.AgentExtension

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

Method Details

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(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(Object requestor,
 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(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