Combine


Waits for the two agents to arrive (in arbitrary order) at ports in1 and in2, produces a new agent and outputs it. The new agent may be a "completely new", i.e. a newly constructed object whose properties possibly depend on the original agents, or it may be one of the original agents, again, possibly modified. Once the two agents are ready, the combine operation takes zero time.

Combine may be used for a number of purposes. First, it can serve as a synchronization point to let one of the agents go further only after another one arrives. Second, you can use Combine to re-join the agent with its copy/sibling created with Split object. Third, Combine may be a simple alternative to Pickup if only one agent is picked up: you can write agent.addEntityToContents( agent2 ) in the On exit code.

Please note that in this object agents may be disposed. Combine however does not know which of them will be disposed and will not check if disposal is OK (i.e. no resources, etc.). It is your responsibility to make sure the disposed agents are "clean".

When you select the resulting agent to be completely new, you can specify the type of this agent in the parameter New agent (combined) which will propagate to other library objects in the flowchart. When you choose the resulting agent to be agent1 or agent2, and this agent is of your custom type, go to the Advanced section and specify this particular type as the Agent type (out) to propagate it in the process flowchart.

The original agent that arrives first may be animated at the specified position.

Parameters

The resulting agent is
Defines how the exiting agent is produced:
Completely new
- creates a new agent of the type specified in the field New agent (combined) below,
agent1
- equals the first original (the other agent is destroyed),
agent2 - equals the second original (the other agent is destroyed).
Get value: combineMode
Set value at runtime: set_combineMode(new value)
Valid values: Completely new  -  Combine.NEW
                     agent1  -  Combine.ENTITY1
                     agent2  -  Combine.ENTITY2
New agent (combined) [dynamic]
[Visible if The resulting agent is: Completely new] The type of the new agent (it can be an expression evaluated to obtain the new agent).
Value type: Agent
Local variables: T1 agent1 - the original agent arrived at in1 port.
             T2 agent2 - the original agent arrived at in2 port.
Change dimensions [dynamic]
If the option is selected (true), you will be able to change the dimensions of the agent combined by this block specifying the new Length, Width and Height values below.
Type of value: boolean
Local variable:  agent - the agent
Length [dynamic]
[Visible if the Change dimensions option is selected] The new length of the combined agent.
Type of value: double
Local variable:  agent - the agent
Width [dynamic]
[Visible if the Change dimensions option is selected] The new width of the combined agent.
Type of value: double
Local variable:  agent - the agent
Height [dynamic]
[Visible if the Change dimensions option is selected] The new height of the combined agent.
Type of value: double
Local variable:  agent - the agent
Agent location (1)
Node or path where the original agent arrived at in1 and waiting for the other one is located.
Syntax: AnimationStaticLocationProvider entityLocation1
Agent location (2)
Node or path where the original agent arrived at in2 and waiting for the other one is located.
Syntax: AnimationStaticLocationProvider entityLocation2
Agent location (combined)
Node or path where the combined agent is located while it hasn't yet been consumed by the subsequent block.
Syntax: AnimationStaticLocationProvider entityLocation
Advanced
Add combined agents to
Here you specify where the combined agents created by this block will be stored: in the default population of root agent, or in some custom population (specified below in the Population property).
Syntax: boolean addToCustomPopulation
Population [dynamic]
[Visible if Add combined agents to: custom population] The name of the agent population where the combined agents created by this block will be stored.
Value type: AgentList
Local variables: agent - the resulting agent that will exit.
             T1 agent1 - the original agent arrived at in1 port.
             T2 agent2 - the original agent arrived at in2 port.
Forced pushing
If the option is selected (true), when agent finishes processing at the block, it is instantly pushed further regardless the state of the succeeding block.
If the option is not selected, agent is not pushed, but pulled: only when the succeeding block is ready to accept one more agent, it requests the agent from this block, and only then this agent passes further.
Syntax: boolean pushProtocol
Default value: false
Restore agent location on exit
If the option is selected, after being animated in the Agent location (1, 2) shapes, the agents will return to their original location (node or path) where they were before entering this Combine block.
Syntax: boolean restoreEntityLocationOnExit
Actions
On enter 1 [code]
Code executed when an original agent enters the object at in1.
Local variable: T1 agent - the agent. 
On enter 2 [code]
Code executed when an original agent enters the object at in2.
Local variable: T2 agent - the agent. 
On exit [code]
Code executed when the resulting agent exits the object. 
Local variables: agent - the resulting agent that will exit.
             T1 agent1 - the original agent arrived at in1 port.
             T2 agent2 - the original agent arrived at in2 port.
Advanced
Agent type (in1), Agent type (in2), Agent type (out)
The type of the original agents arriving at port in1
The type of the original agents arriving at port in2
The type of the agents exiting this object. 
You may need to specify custom agent types for agents to directly access their custom fields in the block actions.
Referred below as: T1, T2, T

Ports

in1
The input port.
in2
The input port.
out
The output port.