Class MapRepresentation

java.lang.Object
eu.su.mas.dedale.mas.agent.knowledge.MapRepresentation
All Implemented Interfaces:
Serializable

public class MapRepresentation extends Object implements Serializable
This simple topology representation only deals with the graph, not its content.

The knowledge representation is not well written (at all), it is just given as a minimal example.

The viewer methods are not independent of the data structure, and the dijkstra is recomputed every-time.

Author:
hc
See Also:
  • Constructor Details

    • MapRepresentation

      public MapRepresentation()
  • Method Details

    • addNode

      public void addNode(String id, MapRepresentation.MapAttribute mapAttribute)
      Add or replace a node and its attribute
      Parameters:
      id - unique identifier of the node
      mapAttribute - attribute to add
    • addNewNode

      public boolean addNewNode(String id)
      Add a node to the graph. Do nothing if the node already exists. If new, it is labeled as open (non-visited)
      Parameters:
      id - id of the node
      Returns:
      true if added
    • addEdge

      public void addEdge(String idNode1, String idNode2)
      Add an undirect edge between idNode1 and idNode2 if not already existing.
      Parameters:
      idNode1 - unique identifier of node 1
      idNode2 - unique identifier of node 2
    • getShortestPath

      public List<String> getShortestPath(String idFrom, String idTo)
      Compute the shortest Path from idFrom to IdTo. The computation is currently not very efficient
      Parameters:
      idFrom - id of the origin node
      idTo - id of the destination node
      Returns:
      the list of nodes to follow, null if the targeted node is not currently reachable
    • getShortestPathToClosestOpenNode

      public List<String> getShortestPathToClosestOpenNode(String myPosition)
    • getOpenNodes

      public List<String> getOpenNodes()
    • prepareMigration

      public void prepareMigration()
      Before the migration we kill all non serializable components and store their data in a serializable form
    • getSerializableGraph

      public dataStructures.serializableGraph.SerializableSimpleGraph<String,MapRepresentation.MapAttribute> getSerializableGraph()
    • loadSavedData

      public void loadSavedData()
      After migration we load the serialized data and recreate the non serializable components (Gui,..)
    • mergeMap

      public void mergeMap(dataStructures.serializableGraph.SerializableSimpleGraph<String,MapRepresentation.MapAttribute> sgreceived)
    • hasOpenNode

      public boolean hasOpenNode()
      Returns:
      true if there exist at least one openNode on the graph