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, java.io.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

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

Constructor Summary

Constructors 
ExtEntityDelegate​(Agent owner)  
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
void addAgentToContents​(Agent entity)
Adds a given agent to the contents of this agent.
java.util.List<Agent> contents()  
ShapeTopLevelPresentationGroup createDefaultAnimation()  
FlowchartBlock currentBlock()
Returns the current flowchart block this agent is being processed in.
void destroyEntity()
Destroys the agent.
double getBlockEnterTime()
Returns the time this agent entered its current flowchart block.
java.awt.Color getColor()
Returns the color of the item default shape.
ShapeTopLevelPresentationGroup getDefaultAnimation()  
double getFlowchartEntryTime()
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
double getHeight()
Returns the height of the agent - used by conveyors and other blocks which require it during processing.
double getHeight​(LengthUnits units)
Returns the height of the agent - used by conveyors and other blocks which require it during processing.
int getId()
Returns Id of agent.
double getLength()
Returns the length of the agent - used by conveyors and other blocks which require it during processing.
double getLength​(LengthUnits units)
Returns the length of the agent - used by conveyors and other blocks which require it during processing.
double getWidth()
Returns the width of the agent - used by conveyors and other blocks which require it during processing.
double getWidth​(LengthUnits units)
Returns the width of the agent - used by conveyors and other blocks which require it during processing.
void highlight​(boolean yes)
Turns on/off highlighting of this agent animation.
boolean onClick()
Should be overridden to define the reaction on mouse click.
int priority()
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)
boolean removeAgentFromContents​(Agent entity)
Removes the given agent from the contents of this agent.
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.
java.util.List<Agent> resourceUnits()
Returns the list of resource units seized by the agent, or empty list if there are none.
java.util.List<Agent> resourceUnitsOfPool​(Agent pool)
Returns resource units currently seized by this agent from the given ResourcePool block
java.util.List<Agent> resourceUnitsOfSeize​(Agent seize)
Return resource units currently seized by this agent in the given Seize block
void setColor​(java.awt.Color color)
Sets the color of the item default shape.
void setFlowchartActivityType​(FlowchartActivityType activityType, FlowchartBlock block)
Sets activity type info (used in e.g.
void setHeight​(double height)
Sets the height of the agent (in meters)
void setHeight​(double height, LengthUnits units)
Sets the height of the agent in the given units
void setLength​(double length)
Sets the length of the agent (in meters)
void setLength​(double length, LengthUnits units)
Sets the length of the agent in the given units
void setWidth​(double width)
Sets the width of the agent (in meters)
void setWidth​(double width, LengthUnits units)
Sets the width of the agent in the given units
Modifier and Type Method Description

Methods inherited from class com.anylogic.engine.ExtAgentWithSpatialMetricsDelegate

agentsInRange, agentsInRange, distanceTo, distanceTo, distanceTo, distanceTo, distanceTo, distanceTo, e, extClass, getAnimationPosition, getAnimationX, getAnimationY, getAnimationZ, getLevel, getNearestAgent, getNetwork, getNetworkNode, getPresentationScaleOnOwnerSpace, getRouteProvider, getSpace, getSpaceType, getSpeed, getSpeed, getTargetX, getTargetY, getVelocity, isAnimationVisible_xjal, isAutomaticHorizontalRotation, isAutomaticVerticalRotation, isMoving, jumpTo, jumpTo, jumpTo, moveTo, moveTo, moveTo, moveToInTime, moveToInTime, moveToInTime, moveToInTime, moveToInTime, moveToInTime, moveToNearestAgent, moveToNearestAgent, moveToStraight, moveToStraightInTime, moveToStraightInTime, onExtensionRemoved, setArrivalCallback, setAutomaticHorizontalRotation, setLevel, setNetwork, setNetworkInternal, setNetworkNode, setNetworkNode, setRouteProvider, setSpace, setSpeed, setSpeed, setVelocity, stop, timeToArrival, timeToArrival, updatePosition

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.ExtAgentWithSpatialMetrics

agentsInRange, agentsInRange, distanceTo, distanceTo, distanceTo, distanceTo, distanceTo, distanceTo, getLevel, getNearestAgent, getNetwork, getNetworkNode, getRouteProvider, getSpaceType, getSpeed, getSpeed, getTargetX, getTargetY, getVelocity, isAutomaticHorizontalRotation, isMoving, jumpTo, jumpTo, jumpTo, moveTo, moveTo, moveTo, moveToInTime, moveToInTime, moveToInTime, moveToInTime, moveToInTime, moveToInTime, moveToNearestAgent, moveToNearestAgent, moveToStraight, moveToStraightInTime, moveToStraightInTime, setArrivalCallback, setAutomaticHorizontalRotation, setLevel, setNetwork, setNetworkInternal, setNetworkNode, setNetworkNode, setRouteProvider, setSpeed, setSpeed, setVelocity, stop, timeToArrival, timeToArrival, updatePosition

Methods inherited from interface com.anylogic.engine.ExtAnimationParams

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

Constructor Detail

ExtEntityDelegate

public ExtEntityDelegate​(Agent owner)

Method Detail

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 java.util.List<Agent> contents()
Specified by:
contents in interface ExtEntity

resourceUnits

public java.util.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 java.util.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 java.util.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​(java.awt.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 java.awt.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
How can we improve this article?