AnyLogic
Expand
Font size

public abstract class AgentExtensionFactory<T extends AgentExtension>
extends Object

Constructor Summary

ConstructorDescription
AgentExtensionFactory() 

Method Summary

Modifier and TypeMethodDescription
abstract Tcreate(Agent owner)
This method should create an extension for the given agent.
If designed, this method may perform check for compatibility with existing agent extensions and may throw error (e.g.
static <T extends AgentExtension>
AgentExtensionFactory<? extends T>
get(Class<T> c) 
static <T extends AgentExtension>
void
register(Class<T> c, AgentExtensionFactory<? extends T> factory)
Registers new extension factory.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

AgentExtensionFactory

public AgentExtensionFactory()

Method Details

register

public static <T extends AgentExtension> void register(Class<T> c,
 AgentExtensionFactory<? extends T> factory)
Registers new extension factory. The reference to the given factory will be stored until Java Virtual Machine shutdown. Hence, the factory instance shouldn't have any references to a particular model and/or simulation results.
Parameters:
c - agent extension class
factory - factory instance

get

@AnyLogicInternalAPI
public static <T extends AgentExtension>
AgentExtensionFactory<? extends T> get(Class<T> c)

create

public abstract T create(Agent owner)
This method should create an extension for the given agent.
If designed, this method may perform check for compatibility with existing agent extensions and may throw error (e.g. requested "Discrete space Agent" while the object already has "Continuous space Agent" extension).
Implementation may invoke nested ext() calls on the agent -- e.g. in cases when it is based on some extension (like "Entity" is based on "Continuous space Agent")
Parameters:
owner -
Returns:
new agent extension