cad.simcad.objectserver.spec.map
Interface AbstractMap

All Known Implementing Classes:
CellMap

public interface AbstractMap

This is the definition of a Map. It is totally abstract It can search itself for a Path.

Version:
1.0
Author:
Charles-Philip

Method Summary
 void addAbstractMapListener(AbstractMapEventListener listener)
           
 void addPathPlaceEventListener(PathPlaceEventListener listener)
           
 double computeHeuristic(PathPlace origin, PathPlace dest)
          Compute the heuristic for the two PathPlaces.
 double computeHeuristic(PathPlace origin, PathPlace dest, double factor)
          Compute the heuristic for the two PathPlaces
 PathPlaceSet fastFindShortestPath(PathPlace origin, PathPlace dest, PathUser pu)
          Find the best Path with a productive algorithm
 PathPlaceSet findShortestPath(PathPlace origin, PathPlace dest, PathUser pu)
          Find the best Path
 PathPlaceSet findShortestPath(PathPlace origin, PathPlace dest, PathUser pu, java.util.Properties algoProperties)
          Find the best Path
 void firePathComputation(PathPlaceSet path)
          This method will be used to notice the Map that a path has been computed.
 void firePathPlaceChange(PathPlace mp)
          This method should be used if you want to notice the Map when a PathPlace has been modified in some way
 java.util.Vector getAbstractMapListener()
          Returns the vector of AbstractMapListener
 MapUnit[][] getAllMapUnits()
          Return as a double Array all the MapUnits making the Map at coordinate z=0
 double getCostToReach(PathPlace from, PathPlace to, PathUser pu)
          This method computes the cost for a PathUser to move from the PathPlace "from" to the PathPlace "to"
 FillerServer getFillerServer()
          Returns the FillerServer of the Map
 java.lang.Object[][] getMapObjects(int xcenter, int ycenter, int halfWidth, int halfHeight)
          Return a window of Objects around the (xcenter,ycenter) point.
 MapUnit getMapUnit(int xfactor, int yfactor)
          Return the MapUnit by the coordinate x and y.
 MapUnit[][] getMapUnit(int xcenter, int ycenter, int halfWidth, int halfHeight)
          Return a window of MapUnit around the (xcenter,ycenter) point.
 java.lang.String getName()
          Returns the name of the Map
 java.lang.Object getObject(int x, int y)
          Get an object at the specified position
 java.util.Vector getPathPlaceEventListeners()
          Returns the vector of PathPlaceEventListeners
 int getResolution()
          Return the resolution of the Map.
 StatServer getStatServer()
          Returns the StatServer of the Map
 int getXFactor()
          Return the X factor of the Map, usually it is the width
 int getYFactor()
          Return the Y factor of the Map, usually it is the height
 int getZFactor()
          Return the Z factor of the Map.
 boolean isThereRoom(int x, int y, int xWidth, int yHeight)
          Return true if there is no object in the range specified by the parameters. false if there is one
 void populateMap(Filler fil)
          Populate the Map with the given Filler
 void removeAbstractMapListener(AbstractMapEventListener listener)
          Removes the AbstractMapEventListener
 void removeAllListeners()
          Removes all listeners, usually used for serialization
 void removePathPlaceEventListener(PathPlaceEventListener listener)
          Removes the PathPlaceEventListener
 void resetAllCellsValue()
          Reset all the cell values
 void resetAllUnits()
          Reset all the Units
 void setHeuristicFactor(int f)
          Set the heuristic factor for this map.
 void setObject(java.lang.Object obj, int x, int y)
          Put an object at the specified position
 

Method Detail

computeHeuristic

public double computeHeuristic(PathPlace origin,
                               PathPlace dest,
                               double factor)
Compute the heuristic for the two PathPlaces

Parameters:
origin - The PathPlace origin from which we want to compute the heuristic
dest - The PathPlace origin from which we want to compute the heuristic
factor - the factor by which we want to multiply the heuristic. Typically, more the factor is high, more we want to give weight to the heuristic
Pre:
see params
Returns:
a double value
Post:
a double value, the heurisitc about the fact dest PathPlace can be easily reached from origin PathPlace

computeHeuristic

public double computeHeuristic(PathPlace origin,
                               PathPlace dest)
Compute the heuristic for the two PathPlaces. Use the built-in heuristic factor. This factor can be change with the setHeuristicFactor method

Parameters:
origin - The PathPlace origin from which we want to compute the heuristic
dest - The PathPlace origin from which we want to compute the heuristic
Pre:
see params
Returns:
a double value
Post:
a double value, the heurisitc about the fact dest PathPlace can be easily reached from origin PathPlace

setHeuristicFactor

public void setHeuristicFactor(int f)
Set the heuristic factor for this map.

Parameters:
f - the heuristic factor

findShortestPath

public PathPlaceSet findShortestPath(PathPlace origin,
                                     PathPlace dest,
                                     PathUser pu,
                                     java.util.Properties algoProperties)
Find the best Path

Parameters:
origin - The Origin of the Path
dest - The destination of the Path
pu - The PathUser that will use the Path
algoProperties - The properties relative to the Algorithm
Pre:
see params
Returns:
A PathPlaceSet object. The set of PathPlaces that make up the best Path for that PathUser
Post:
The Values of the MapUnits might have changed if the Algorithm is in test mode The values exist only for information anyway

findShortestPath

public PathPlaceSet findShortestPath(PathPlace origin,
                                     PathPlace dest,
                                     PathUser pu)
Find the best Path

Parameters:
origin - The Origin of the Path
dest - The destination of the Path
pu - The PathUser that will use the Path
Pre:
see params
Returns:
A PathPlaceSet object. The set of PathPlaces that make up the best Path for that PathUser
Post:
The Values of the MapUnits might have changed if the Algorithm is in test mode The values exist only for information anyway

fastFindShortestPath

public PathPlaceSet fastFindShortestPath(PathPlace origin,
                                         PathPlace dest,
                                         PathUser pu)
Find the best Path with a productive algorithm

Parameters:
origin - The Origin of the Path
dest - The destination of the Path
pu - The PathUser that will use the Path
Pre:
see params
Returns:
A PathPlaceSet object. The set of PathPlaces that make up the best Path for that PathUser
Post:

firePathComputation

public void firePathComputation(PathPlaceSet path)
This method will be used to notice the Map that a path has been computed. This method should take appropriate action

Parameters:
path - The computed PathPlaceSet
Pre:
see Param
Post:
Appropriate action has been taken

firePathPlaceChange

public void firePathPlaceChange(PathPlace mp)
This method should be used if you want to notice the Map when a PathPlace has been modified in some way

Parameters:
mp - The PathPlace that has been modified
Pre:
see params
Post:
The MapPlace has been updated

getCostToReach

public double getCostToReach(PathPlace from,
                             PathPlace to,
                             PathUser pu)
This method computes the cost for a PathUser to move from the PathPlace "from" to the PathPlace "to"

Parameters:
from - The origin
to - the destination
pu - The PathUser
Pre:
Two adjacent PathPlaces and a PathUser
Returns:
a double value
Post:
the cost for moving from the first PathPlace to the second PathPlace being that PathUser

getResolution

public int getResolution()
Return the resolution of the Map. A Resolution of 1 means that the Map use a single MapUnit for the smallest object A Resolution of 2 means that the Map use two MapUnits for the smallest object ...

Pre:
-
Returns:
a integer
Post:
The resolution of the Map

getXFactor

public int getXFactor()
Return the X factor of the Map, usually it is the width

Pre:
-
Returns:
an integer
Post:
the X factor of the map. The width on a classic map

getYFactor

public int getYFactor()
Return the Y factor of the Map, usually it is the height

Pre:
-
Returns:
an integer
Post:
the Y factor of the map. The height on a classic map

getZFactor

public int getZFactor()
Return the Z factor of the Map. Usually the Altitude

Pre:
-
Returns:
an integer
Post:
the Z factor of the map. The Altitude on a classic map

getMapUnit

public MapUnit getMapUnit(int xfactor,
                          int yfactor)
Return the MapUnit by the coordinate x and y. Since we do not ask for z coordinate, it is taken as 0

Parameters:
yfactor - y coordinate
xfactor - x coordinate
Pre:
xfactor and y factor, i.e. the coordinates for a classic map
Returns:
a MapUnit
Post:
the corresponding MapUnit, with z being 0

getMapUnit

public MapUnit[][] getMapUnit(int xcenter,
                              int ycenter,
                              int halfWidth,
                              int halfHeight)
Return a window of MapUnit around the (xcenter,ycenter) point. Radius in width is halfWidth, Radius in height is halfHeight. Please read the @post comment

Parameters:
xcenter - x coordinate
ycenter - y coordinate
halfWidth - the number of MapUnit we want to include.
halfHeight - the number of MapUnit we want to include
Pre:
a point on the map (xcenter,ycenter), halfWidth = the number of units to considere north/south halfHeight = the number of units to consider west/east
Returns:
a double Array of MapUnits
Post:
the MapUnits contained in the range defined by the arguments that is ((2*_halfWidth)+1)*((2*_halfHeight)+1). z coordinate is 0;

getAllMapUnits

public MapUnit[][] getAllMapUnits()
Return as a double Array all the MapUnits making the Map at coordinate z=0

Pre:
-
Returns:
All the MapUnits with z coordinate z=0
Post:
all the MapUnits making the Map at coordinate z=0

getMapObjects

public java.lang.Object[][] getMapObjects(int xcenter,
                                          int ycenter,
                                          int halfWidth,
                                          int halfHeight)
Return a window of Objects around the (xcenter,ycenter) point. Radius in width is halfWidth, Radius in height is halfHeight. Please read the @post comment

Parameters:
xcenter - x coordinate
ycenter - y coordinate
halfWidth - the number of Objects we want to include.
halfHeight - the number of Objects we want to include
Pre:
a point on the map (xcenter,ycenter), halfWidth = the number of units to considere north/south halfHeight = the number of units to consider west/east
Returns:
a double Array of MapUnits
Post:
the Objects contained in the range defined by the arguments that is ((2*_halfWidth)+1)*((2*_halfHeight)+1). z coordinate is 0;

setObject

public void setObject(java.lang.Object obj,
                      int x,
                      int y)
Put an object at the specified position

Parameters:
obj - The object to put
x - x coordinate
y - y coordinate
Pre:
The Object to
Post:
The Map is update and now knows that the object is there. If there was alreay an object at this coordinate, it is erased.

getObject

public java.lang.Object getObject(int x,
                                  int y)
Get an object at the specified position

Parameters:
x - x coordinate
y - y coordinate
Pre:
The Object to
Returns:
An Object. Null if there is none
Post:
The Object.

isThereRoom

public boolean isThereRoom(int x,
                           int y,
                           int xWidth,
                           int yHeight)
Return true if there is no object in the range specified by the parameters. false if there is one

Parameters:
x - x coordinate
y - y coordinate
xWidth - length in width of the Object
yHeight - length in height of the Object
Returns:
a boolean
Post:
true if there is no objects in the area defined by the rectangle, Return true if there is no object in the range specified by the parameters. false if there is one

addAbstractMapListener

public void addAbstractMapListener(AbstractMapEventListener listener)

removeAbstractMapListener

public void removeAbstractMapListener(AbstractMapEventListener listener)
Removes the AbstractMapEventListener


addPathPlaceEventListener

public void addPathPlaceEventListener(PathPlaceEventListener listener)

removePathPlaceEventListener

public void removePathPlaceEventListener(PathPlaceEventListener listener)
Removes the PathPlaceEventListener


removeAllListeners

public void removeAllListeners()
Removes all listeners, usually used for serialization


resetAllUnits

public void resetAllUnits()
Reset all the Units


resetAllCellsValue

public void resetAllCellsValue()
Reset all the cell values


populateMap

public void populateMap(Filler fil)
Populate the Map with the given Filler

Parameters:
fil - The Filler

getStatServer

public StatServer getStatServer()
Returns the StatServer of the Map

Pre:
-
Post:
The StatServer of this Map

getFillerServer

public FillerServer getFillerServer()
Returns the FillerServer of the Map

Pre:
-
Post:
the FillerServer of this Map

getName

public java.lang.String getName()
Returns the name of the Map

Pre:
-
Post:
the FillerServer of this Map

getPathPlaceEventListeners

public java.util.Vector getPathPlaceEventListeners()
Returns the vector of PathPlaceEventListeners

Pre:
-

getAbstractMapListener

public java.util.Vector getAbstractMapListener()
Returns the vector of AbstractMapListener

Pre:
-

Logo

With the help of www.sourceforge.net and www.info.ucl.ac.be