All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.massisframework.massis.ai.sposh.senses.SeesElement Maven / Gradle / Ivy

There is a newer version: 1.2.22
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy