AnyLogic
Expand
Font size
Type Parameters:
E - type of agent extension to delegate to. If you are creating new extension based on 'Entity', please set the type to ExtEntity
All Implemented Interfaces:
AgentExtension, ExtAgentWithSpatialMetrics, ExtAnimationParams, ExtDefaultAnimationProvider, ExtEntity, Serializable

@AnyLogicInternalAPI
public abstract class ExtEntityDelegate<E extends ExtEntity>
extends ExtAgentWithSpatialMetricsDelegate<E>
implements ExtEntity
Base class for extensions delegating their 'Entity' activity to an existing extension of agent
See Also:
Serialized Form

Field Summary

Constructor Summary

ConstructorDescription
ExtEntityDelegate(Agent owner) 

Method Summary

Modifier and TypeMethodDescription
voidaddAgentToContents(Agent entity)
Adds a given agent to the contents of this agent.
List<Agent>contents() 
ShapeTopLevelPresentationGroupcreateDefaultAnimation() 
FlowchartBlockcurrentBlock()
Returns the current flowchart block this agent is being processed in.
voiddestroyEntity()
Destroys the agent.
doublegetBlockEnterTime()
Returns the time this agent entered its current flowchart block.
ColorgetColor()
Returns the color of the item default shape.
ShapeTopLevelPresentationGroupgetDefaultAnimation() 
doublegetFlowchartEntryTime()
Returns the time the agent has entered the first block in the flowchart, or Double.NaN if this agent hasn't yet visited any flowchart
doublegetHeight()
Returns the height of the agent - used by conveyors and other blocks which require it during processing.
doublegetHeight(LengthUnits units)
Returns the height of the agent - used by conveyors and other blocks which require it during processing.
intgetId()
Returns Id of agent.
doublegetLength()
Returns the length of the agent - used by conveyors and other blocks which require it during processing.
doublegetLength(LengthUnits units)
Returns the length of the agent - used by conveyors and other blocks which require it during processing.
doublegetWidth()
Returns the width of the agent - used by conveyors and other blocks which require it during processing.
doublegetWidth(LengthUnits units)
Returns the width of the agent - used by conveyors and other blocks which require it during processing.
voidhighlight(boolean yes)
Turns on/off highlighting of this agent animation.
booleanonClick()
Should be overridden to define the reaction on mouse click.
intpriority()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
This function is used for sorting extensions (in order for the overriding delegation to work)
booleanremoveAgentFromContents(Agent entity)
Removes the given agent from the contents of this agent.
AgentresourceUnitOfPool(Agent pool)
Returns the first occurrence of resource unit of a given pool among the seized resource units, or null if not found.
List<Agent>resourceUnits()
Returns the list of resource units seized by the agent, or empty list if there are none.
List<Agent>resourceUnitsOfPool(Agent pool)
Returns resource units currently seized by this agent from the given ResourcePool block
List<Agent>resourceUnitsOfSeize(Agent seize)
Return resource units currently seized by this agent in the given Seize block
voidsetColor(Color color)
Sets the color of the item default shape.
voidsetFlowchartActivityType(FlowchartActivityType activityType, FlowchartBlock block)
Sets activity type info (used in e.g.
voidsetHeight(double height)
Sets the height of the agent (in meters)
voidsetHeight(double height, LengthUnits units)
Sets the height of the agent in the given units
voidsetLength(double length)
Sets the length of the agent (in meters)
voidsetLength(double length, LengthUnits units)
Sets the length of the agent in the given units
voidsetWidth(double width)
Sets the width of the agent (in meters)
voidsetWidth(double width, LengthUnits units)
Sets the width of the agent in the given units

Methods inherited from class com.anylogic.engine.AgentExtensionImpl

error, error, getAgent, getSupportedInterfaces_xjal, next_xjal, onDestroy, setNext_xjal, supportsInterface_xjal

Methods inherited from class java.lang.Object

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

Methods inherited from interface com.anylogic.engine.AgentExtension

getAgent, next_xjal, onDestroy, onExtensionRemoved, setNext_xjal, supportsInterface_xjal

Methods inherited from interface com.anylogic.engine.ExtAnimationParams

getAnimationPosition, getAnimationX, getAnimationY, getAnimationZ, getPresentationScaleOnOwnerSpace, getSpace, isAnimationVisible_xjal, setSpace

Constructor Details

ExtEntityDelegate

public ExtEntityDelegate(Agent owner)

Method Details

destroyEntity

@AnyLogicInternalAPI
public void destroyEntity()
Description copied from interface: ExtEntity
Destroys the agent.
Specified by:
destroyEntity in interface ExtEntity

highlight

public void highlight(boolean yes)
Description copied from interface: ExtEntity
Turns on/off highlighting of this agent animation. The behavior of the function is specific for different agent types and usually depends on the library which drives this agent
Specified by:
highlight in interface ExtEntity

getId

public int getId()
Description copied from interface: ExtEntity
Returns Id of agent. This method is designed only for debug purposes. It doesn't guarantees that id is unique.
Note that when the model produces more than ~billion agents then there may be agents with negative and even equal ids.
Specified by:
getId in interface ExtEntity
Returns:
Id of agent

getFlowchartEntryTime

public double getFlowchartEntryTime()
Description copied from interface: ExtEntity
Returns the time the agent has entered the first block in the flowchart, or Double.NaN if this agent hasn't yet visited any flowchart
Specified by:
getFlowchartEntryTime in interface ExtEntity
Returns:
time or Double.NaN

addAgentToContents

public void addAgentToContents(Agent entity)
Description copied from interface: ExtEntity
Adds a given agent to the contents of this agent.
Specified by:
addAgentToContents in interface ExtEntity
Parameters:
entity - the agent to add

removeAgentFromContents

public boolean removeAgentFromContents(Agent entity)
Description copied from interface: ExtEntity
Removes the given agent from the contents of this agent.
Specified by:
removeAgentFromContents in interface ExtEntity
Parameters:
entity - the agent to remove
Returns:
returns true if agent was removed, false if this agent didn't contain the specified agent

getLength

public double getLength()
Description copied from interface: ExtEntity
Returns the length of the agent - used by conveyors and other blocks which require it during processing.
Specified by:
getLength in interface ExtEntity
Returns:
the length of the agent

getLength

public double getLength(LengthUnits units)
Description copied from interface: ExtEntity
Returns the length of the agent - used by conveyors and other blocks which require it during processing.
Specified by:
getLength in interface ExtEntity
Parameters:
units - units of length to be used
Returns:
the length of the agent

setLength

public void setLength(double length)
Description copied from interface: ExtEntity
Sets the length of the agent (in meters)
Specified by:
setLength in interface ExtEntity

setLength

public void setLength(double length,
 LengthUnits units)
Description copied from interface: ExtEntity
Sets the length of the agent in the given units
Specified by:
setLength in interface ExtEntity
Parameters:
length - the length of the agent
units - units of length to be used

getWidth

public double getWidth()
Description copied from interface: ExtEntity
Returns the width of the agent - used by conveyors and other blocks which require it during processing.
Specified by:
getWidth in interface ExtEntity
Returns:
the width of the agent

getWidth

public double getWidth(LengthUnits units)
Description copied from interface: ExtEntity
Returns the width of the agent - used by conveyors and other blocks which require it during processing.
Specified by:
getWidth in interface ExtEntity
Parameters:
units - units of length to be used
Returns:
the width of the agent

setWidth

public void setWidth(double width)
Description copied from interface: ExtEntity
Sets the width of the agent (in meters)
Specified by:
setWidth in interface ExtEntity

setWidth

public void setWidth(double width,
 LengthUnits units)
Description copied from interface: ExtEntity
Sets the width of the agent in the given units
Specified by:
setWidth in interface ExtEntity
Parameters:
width - the width of the agent
units - units of length to be used

getHeight

public double getHeight()
Description copied from interface: ExtEntity
Returns the height of the agent - used by conveyors and other blocks which require it during processing.
Specified by:
getHeight in interface ExtEntity
Returns:
the height of the agent

getHeight

public double getHeight(LengthUnits units)
Description copied from interface: ExtEntity
Returns the height of the agent - used by conveyors and other blocks which require it during processing.
Specified by:
getHeight in interface ExtEntity
Parameters:
units - units of length to be used
Returns:
the height of the agent

setHeight

public void setHeight(double height)
Description copied from interface: ExtEntity
Sets the height of the agent (in meters)
Specified by:
setHeight in interface ExtEntity

setHeight

public void setHeight(double height,
 LengthUnits units)
Description copied from interface: ExtEntity
Sets the height of the agent in the given units
Specified by:
setHeight in interface ExtEntity
Parameters:
height - the height of the agent
units - units of length to be used

contents

public List<Agent> contents()
Specified by:
contents in interface ExtEntity

resourceUnits

public List<Agent> resourceUnits()
Description copied from interface: ExtEntity
Returns the list of resource units seized by the agent, or empty list if there are none.
Specified by:
resourceUnits in interface ExtEntity
Returns:
the list of resource units seized by the agent, never returns null

resourceUnitsOfSeize

public List<Agent> resourceUnitsOfSeize(Agent seize)
Description copied from interface: ExtEntity
Return resource units currently seized by this agent in the given Seize block
Specified by:
resourceUnitsOfSeize in interface ExtEntity
Parameters:
seize - Seize block
Returns:
resource units currently seized by this agent

resourceUnitsOfPool

public List<Agent> resourceUnitsOfPool(Agent pool)
Description copied from interface: ExtEntity
Returns resource units currently seized by this agent from the given ResourcePool block
Specified by:
resourceUnitsOfPool in interface ExtEntity
Parameters:
pool - ResourcePool block
Returns:
resource units currently seized by this agent

resourceUnitOfPool

public Agent resourceUnitOfPool(Agent pool)
Description copied from interface: ExtEntity
Returns the first occurrence of resource unit of a given pool among the seized resource units, or null if not found.
Specified by:
resourceUnitOfPool in interface ExtEntity
Parameters:
pool - the pool of the unit (ResourcePool block)
Returns:
the seized resource unit from the given pool, if found

currentBlock

public FlowchartBlock currentBlock()
Description copied from interface: ExtEntity
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.
Specified by:
currentBlock in interface ExtEntity
Returns:
the current flowchart block containing this agent or null if the agent isn't in flowchart

getBlockEnterTime

public double getBlockEnterTime()
Description copied from interface: ExtEntity
Returns the time this agent entered its current flowchart block.
Specified by:
getBlockEnterTime in interface ExtEntity
Returns:
the time this agent entered its current flowchart block or Double.NaN if this agent isn't in the flowchart

setColor

public void setColor(Color color)
Description copied from interface: ExtEntity
Sets the color of the item default shape.
Specified by:
setColor in interface ExtEntity
Parameters:
color - the new color of the default shape

getColor

public Color getColor()
Description copied from interface: ExtEntity
Returns the color of the item default shape.
Specified by:
getColor in interface ExtEntity
Returns:
the color of the item default shape

getDefaultAnimation

public ShapeTopLevelPresentationGroup getDefaultAnimation()
Specified by:
getDefaultAnimation in interface ExtDefaultAnimationProvider

createDefaultAnimation

@AnyLogicInternalAPI
public ShapeTopLevelPresentationGroup createDefaultAnimation()
Specified by:
createDefaultAnimation in interface ExtDefaultAnimationProvider

onClick

@AnyLogicInternalAPI
public boolean onClick()
Description copied from interface: ExtDefaultAnimationProvider
Should be overridden to define the reaction on mouse click.
Specified by:
onClick in interface ExtDefaultAnimationProvider
Returns:
always return false here.

setFlowchartActivityType

public void setFlowchartActivityType(FlowchartActivityType activityType,
 FlowchartBlock block)
Description copied from interface: ExtEntity
Sets activity type info (used in e.g. logging to DB) for the given entity
Specified by:
setFlowchartActivityType in interface ExtEntity
See Also:
FlowchartActivityType

priority

public int priority()
Description copied from interface: AgentExtension
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
This function is used for sorting extensions (in order for the overriding delegation to work)
Specified by:
priority in interface AgentExtension
Overrides:
priority in class ExtAgentWithSpatialMetricsDelegate<E extends ExtEntity>
Returns:
int value, see also P_* constants