jadex.micro.examples.heatbugs.DiffusionProcess Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-micro Show documentation
Show all versions of jadex-applications-micro Show documentation
The Jadex micro applications package contains several example applications, benchmarks and testcases using micro agents.
package jadex.micro.examples.heatbugs;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import jadex.bridge.service.types.clock.IClockService;
import jadex.commons.SimplePropertyObject;
import jadex.extension.envsupport.environment.IEnvironmentSpace;
import jadex.extension.envsupport.environment.ISpaceObject;
import jadex.extension.envsupport.environment.ISpaceProcess;
import jadex.extension.envsupport.environment.space2d.Grid2D;
import jadex.extension.envsupport.environment.space2d.Space2D;
import jadex.extension.envsupport.math.IVector2;
import jadex.extension.envsupport.math.Vector1Int;
import jadex.extension.envsupport.math.Vector2Int;
/**
* Diffusion process.
*/
public class DiffusionProcess extends SimplePropertyObject implements ISpaceProcess
{
//-------- attributes --------
/** The last tick. */
protected double lasttick;
//-------- ISpaceProcess interface --------
/**
* This method will be executed by the object before the process gets added
* to the execution queue.
* @param clock The clock.
* @param space The space this process is running in.
*/
public void start(IClockService clock, IEnvironmentSpace space)
{
this.lasttick = clock.getTick();
boolean random_init = getProperty("random_init")!=null?
((Boolean)getProperty("random_init")).booleanValue(): false;
// Initialize the field.
Space2D grid = (Space2D)space;
int sizex = grid.getAreaSize().getXAsInteger();
int sizey = grid.getAreaSize().getYAsInteger();
for(int x=0; x