com.massisframework.massis.ai.sposh.senses.SeesElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of massis-ai-sposh Show documentation
Show all versions of massis-ai-sposh Show documentation
SPOSH High Level Controller
package com.massisframework.massis.ai.sposh.senses;
import cz.cuni.amis.pogamut.sposh.executor.Param;
import cz.cuni.amis.pogamut.sposh.executor.PrimitiveInfo;
import com.massisframework.massis.ai.sposh.SimulationContext;
import com.massisframework.massis.model.agents.LowLevelAgent;
/**
* True if sees another with the attribute and value provided
*
* @author rpax
*
* @param
*/
@PrimitiveInfo(
name = "Sees Element",
description =
"True if sees another with the attribute and value provided")
public class SeesElement extends SimulationSense {
public SeesElement(SimulationContext ctx)
{
super(ctx);
}
public Boolean query(@Param("$attr") String attr,
@Param("$value") Integer val)
{
for (LowLevelAgent v : this.ctx.getBot().getAgentsInVisionRadio())
{
if (val.equals(v.getProperty(attr)))
{
return true;
}
}
return false;
}
}