Class jmeEnvironment

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

public class jmeEnvironment
extends java.lang.Object
implements IEnvironment
  • Constructor Summary

    Constructors 
    Constructor Description
    jmeEnvironment()  
  • Method Summary

    Modifier and Type Method Description
    boolean closeLock​(Location l)  
    void CreateEnvironment​(GeneratorType g, java.lang.String topologyConfigurationFilePath, java.lang.String instanceConfiguration, boolean diamond, boolean gold, boolean well, java.lang.Integer... topologyParameters)
    Create an environment.
    void CreateEnvironment​(java.lang.String topologyConfigurationFilePath, java.lang.String instanceConfiguration, boolean isGrid, java.lang.Integer envSize, boolean diamond, boolean gold, boolean well)
    Deprecated. 
    void deployEntity​(java.lang.String entityName, EntityCharacteristics e, Location locationId)
    Add an entity to the graph
    boolean dropOff​(Location location, ElementType e, java.lang.Integer quantity)
    This methods can only be called by specific types of agents.
    Location getCurrentPosition​(java.lang.String agentName)  
    java.lang.String getName()  
    boolean isReachable​(java.lang.String senderName, java.lang.String receiverName, int communicationReach)  
    java.lang.Integer moveTo​(java.lang.String entityName, EntityCharacteristics ec, Location targetedPosition)  
    java.util.List<dataStructures.tuple.Couple<Location,​java.util.List<dataStructures.tuple.Couple<Observation,​java.lang.Integer>>>> observe​(Location currentPosition, java.lang.String agentName)  
    boolean openLock​(java.lang.String entityName, Location location, ElementType e)  
    int pick​(java.lang.String entityName, Location location, ElementType e, java.lang.Integer maxQuantity)  
    void removeEntity​(java.lang.String entityName, EntityCharacteristics e)  
    boolean throwGrenade​(java.lang.String agentName, Location locationId)  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • CreateEnvironment

      public void CreateEnvironment​(GeneratorType g, java.lang.String topologyConfigurationFilePath, java.lang.String instanceConfiguration, boolean diamond, boolean gold, boolean well, java.lang.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​(java.lang.String topologyConfigurationFilePath, java.lang.String instanceConfiguration, boolean isGrid, java.lang.Integer envSize, boolean diamond, boolean gold, boolean well)
      Deprecated.
      Description copied from interface: IEnvironment
      Create an environment.
      Specified by:
      CreateEnvironment in interface IEnvironment
      Parameters:
      topologyConfigurationFilePath - FullPath to the file describing it. If the environment is autogenerated, null .
      instanceConfiguration - FullPath to the file describing it. If the environment is autogenerated, null.
      isGrid - true id the generated environment is a grid
      envSize - size of the generated environment
      diamond - true if diamond have to be generated
      gold - true if gold have to be generated
      well - true if wells have to be generated
    • deployEntity

      public void deployEntity​(java.lang.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​(java.lang.String entityName, EntityCharacteristics e)
      Specified by:
      removeEntity in interface IEnvironment
    • getCurrentPosition

      public Location getCurrentPosition​(java.lang.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 java.util.List<dataStructures.tuple.Couple<Location,​java.util.List<dataStructures.tuple.Couple<Observation,​java.lang.Integer>>>> observe​(Location currentPosition, java.lang.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 java.lang.Integer moveTo​(java.lang.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​(java.lang.String entityName, Location location, ElementType e, java.lang.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​(java.lang.String senderName, java.lang.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, java.lang.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​(java.lang.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 java.lang.String getName()
      Specified by:
      getName in interface IEnvironment
      Returns:
      The name of the environment
    • openLock

      public boolean openLock​(java.lang.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