Class jmeEnvironment

java.lang.Object
eu.su.mas.dedale.env.jme.jmeEnvironment
All Implemented Interfaces:
IEnvironment

public class jmeEnvironment extends Object implements IEnvironment
  • Constructor Details

    • jmeEnvironment

      public jmeEnvironment()
  • Method Details

    • CreateEnvironment

      public void CreateEnvironment(GeneratorType g, String topologyConfigurationFilePath, String instanceConfiguration, boolean diamond, boolean gold, boolean well, Integer... topologyParameters)
      Description copied from interface: IEnvironment
      Create an environment.
      Specified by:
      CreateEnvironment in interface IEnvironment
      Parameters:
      g - Type of environment (generated or manually designed)
      topologyConfigurationFilePath - FullPath to the file describing the topology
      instanceConfiguration - FullPath to the file describing the elements available on the map
      diamond - true if an automatically generated env should have diamond nodes on it
      gold - true if an automatically generated env should have gold nodes on it
      well - true if an automatically generated env should have wells on it
      topologyParameters - parameters used by the choosen generator. The number of parameters is generator dependent (size,...) All existing features are not available in randomly generated env : Treasure Locks,..
    • CreateEnvironment

      public void CreateEnvironment(String topologyConfigurationFilePath, String instanceConfiguration, boolean isGrid, Integer envSize, boolean diamond, boolean gold, boolean well)
      Deprecated.
    • deployEntity

      public void deployEntity(String entityName, EntityCharacteristics e, Location locationId)
      Description copied from interface: IEnvironment
      Add an entity to the graph
      Specified by:
      deployEntity in interface IEnvironment
      Parameters:
      entityName - the name of the entity to deploy
      e - the EntityCharacteristics of the entity
      locationId - the (unique) Id of the position to deploy the agent, null if free
    • removeEntity

      public void removeEntity(String entityName, EntityCharacteristics e)
      Specified by:
      removeEntity in interface IEnvironment
    • getCurrentPosition

      public Location getCurrentPosition(String agentName)
      Specified by:
      getCurrentPosition in interface IEnvironment
      Parameters:
      agentName - Name of the agent to locate
      Returns:
      The entity current position, null if the entity is not in the environment
    • observe

      public List<dataStructures.tuple.Couple<Location,List<dataStructures.tuple.Couple<Observation,String>>>> observe(Location currentPosition, String agentName)
      Specified by:
      observe in interface IEnvironment
      Parameters:
      currentPosition - the position from which the agent observe
      agentName - the name of the agent
      Returns:
      The list of observed positions, and for each one the list of observations
    • moveTo

      public Integer moveTo(String entityName, EntityCharacteristics ec, Location targetedPosition)
      Specified by:
      moveTo in interface IEnvironment
      Parameters:
      entityName - the name of the entity
      ec - characteristics of the entity
      targetedPosition - its expected destination
      Returns:
      1 if true, 0 if refused, -1 if the consequence of the move is the agent dying
    • pick

      public int pick(String entityName, Location location, ElementType e, Integer maxQuantity)
      Specified by:
      pick in interface IEnvironment
      Parameters:
      entityName - the name of the entity
      location - the position to pick the resource
      e - ElementType to pick
      maxQuantity - maximum number of e that the agent is able to pick
      Returns:
      the amount of resources that the agent was able to collect
    • isReachable

      public boolean isReachable(String senderName, String receiverName, int communicationReach)
      Specified by:
      isReachable in interface IEnvironment
      Parameters:
      senderName - the senderAgent
      receiverName - The agent we are trying to contact
      communicationReach - the sender agent's com capability
      Returns:
      true if the receiver is within reach
    • dropOff

      public boolean dropOff(Location location, ElementType e, Integer quantity)
      Description copied from interface: IEnvironment
      This methods can only be called by specific types of agents. For the others it will do nothing.
      Specified by:
      dropOff in interface IEnvironment
      Parameters:
      location - id of the node where to drop the element
      e - the element the entity intends to drop
      quantity - the amount of value to drop on the current position
      Returns:
      true if the drop off was realised
    • throwGrenade

      public boolean throwGrenade(String agentName, Location locationId)
      Specified by:
      throwGrenade in interface IEnvironment
      Parameters:
      agentName - The name of the agent that is shooting
      locationId - the id of the room it aims at
      Returns:
      true if done, false otherwise
    • getName

      public String getName()
      Specified by:
      getName in interface IEnvironment
      Returns:
      The name of the environment
    • openLock

      public boolean openLock(String entityName, Location location, ElementType e)
      Specified by:
      openLock in interface IEnvironment
      Parameters:
      entityName - the name of the entity
      location - the position to pick the resource
      e - Type of resource to unlock in the environment (Currently only gold or diamond )
      Returns:
      True is the lock is opened, false otherwise
    • closeLock

      public boolean closeLock(Location l)
      Specified by:
      closeLock in interface IEnvironment
      Parameters:
      l - the position to close the safe(s)
      Returns:
      True if there was at least one safe on the current position (they are now closed), false otherwise