Class MapRepresentation
java.lang.Object
eu.su.mas.dedale.mas.agent.knowledge.MapRepresentation
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumA node is open, closed, or agent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an undirect edge between idNode1 and idNode2 if not already existing.booleanaddNewNode(String id) Add a node to the graph.voidaddNode(String id, MapRepresentation.MapAttribute mapAttribute) Add or replace a node and its attributedataStructures.serializableGraph.SerializableSimpleGraph<String, MapRepresentation.MapAttribute> getShortestPath(String idFrom, String idTo) Compute the shortest Path from idFrom to IdTo.getShortestPathToClosestOpenNode(String myPosition) booleanvoidAfter migration we load the serialized data and recreate the non serializable components (Gui,..)voidmergeMap(dataStructures.serializableGraph.SerializableSimpleGraph<String, MapRepresentation.MapAttribute> sgreceived) voidBefore the migration we kill all non serializable components and store their data in a serializable form
-
Constructor Details
-
MapRepresentation
public MapRepresentation()
-
-
Method Details
-
addNode
Add or replace a node and its attribute- Parameters:
id- unique identifier of the nodemapAttribute- attribute to add
-
addNewNode
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
Add an undirect edge between idNode1 and idNode2 if not already existing.- Parameters:
idNode1- unique identifier of node 1idNode2- unique identifier of node 2
-
getShortestPath
Compute the shortest Path from idFrom to IdTo. The computation is currently not very efficient- Parameters:
idFrom- id of the origin nodeidTo- id of the destination node- Returns:
- the list of nodes to follow, null if the targeted node is not currently reachable
-
getShortestPathToClosestOpenNode
-
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
-