net.sf.freecol.common.model
Class Map

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObject
          extended by net.sf.freecol.common.model.Map

public class Map
extends FreeColGameObject

An isometric map. The map is represented as a collection of tiles.


Nested Class Summary
 class Map.CircleIterator
          An interator returning positions in a spiral starting at a given center tile.
static class Map.Direction
          The directions a Unit can move to.
static class Map.PathType
          Constant used for given options in findPath(Unit, Tile, Tile).
static class Map.Position
          Represents a position on the Map.
 class Map.WholeMapIterator
           
 
Field Summary
static int COST_INFINITY
          The infinity cost as used by findPath(Unit, Tile, Tile).
static int NUMBER_OF_DIRECTIONS
           
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
Map(Game game, java.lang.String id)
          Initiates a new Map with the given ID.
Map(Game game, Tile[][] tiles)
          Create a new Map from a collection of tiles.
Map(Game game, javax.xml.stream.XMLStreamReader in)
          Create a new Map from an Element in a DOM-parsed XML-tree.
 
Method Summary
 PathNode findPath(Tile start, Tile end, Map.PathType type)
          Finds a shortest path between the given tiles.
 PathNode findPath(Unit unit, Tile start, Tile end)
          Finds a shortest path between the given tiles.
 PathNode findPath(Unit unit, Tile start, Tile end, CostDecider costDecider)
          Finds a shortest path between the given tiles.
 PathNode findPath(Unit unit, Tile start, Tile end, Unit carrier)
          Finds a shortest path between the given tiles.
 PathNode findPath(Unit unit, Tile start, Tile end, Unit carrier, CostDecider costDecider)
          Finds a shortest path between the given tiles.
 PathNode findPathToEurope(Tile start)
          Finds the best path to Europe independently of any unit.
 PathNode findPathToEurope(Unit unit, Tile start)
          Finds the best path to Europe.
 PathNode findPathToEurope(Unit unit, Tile start, CostDecider costDecider)
          Finds the best path to Europe.
static Map.Position getAdjacent(Map.Position position, Map.Direction direction)
          Gets the position adjacent to a given position, in a given direction.
 java.util.Iterator<Map.Position> getAdjacentIterator(Map.Position centerPosition)
          Get an adjacent iterator.
 Tile getAdjacentTile(Map.Position position, Map.Direction direction)
          Gets the position adjacent Tile to a given Tile, in a given direction.
 java.lang.Iterable<Tile> getAllTiles()
          Make the map usable as a parameter in the for-loop.
 java.util.Iterator<Map.Position> getBorderAdjacentIterator(Map.Position centerPosition)
          Get a border adjacent iterator.
 Map.CircleIterator getCircleIterator(Map.Position center, boolean isFilled, int radius)
          Get a circle iterator.
 Map.Direction getDirection(Tile t1, Tile t2)
          Returns the direction a unit needs to move in order to get from t1 to t2
 int getDistance(int ax, int ay, int bx, int by)
          Gets the distance in tiles between two map positions.
 int getDistance(Map.Position position1, Map.Position position2)
          Gets the distance in tiles between two map positions.
 java.util.Iterator<Map.Position> getFloodFillIterator(Map.Position centerPosition)
          Get a flood fill iterator.
 int getHeight()
          Returns the height of this Map.
 Tile getNeighbourOrNull(Map.Direction direction, int x, int y)
          Returns the neighbouring Tile of the given Tile in the given direction.
 Tile getNeighbourOrNull(Map.Direction direction, Tile t)
          Returns the neighbouring Tile of the given Tile in the given direction.
 Map.Position getRandomLandPosition(java.util.Random random)
          Select a random land position on the map.
 Region getRegion(java.lang.String id)
          Returns the Region with the given ID.
 Region getRegionByName(java.lang.String id)
          Returns the Region with the given name.
 java.util.Collection<Region> getRegions()
           
 java.util.List<Tile> getSurroundingTiles(Tile t, int range)
          Returns all the tiles surrounding the given tile within the given range.
 Tile getTile(int x, int y)
          Returns the Tile at position (x, y).
 Tile getTile(Map.Position p)
          Returns the Tile at a requested position.
 Map.WholeMapIterator getWholeMapIterator()
          Gets an Iterator of every Tile on the map.
 int getWidth()
          Returns the width of this Map.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 boolean isAdjacentToMapEdge(Tile tile)
          Checks if the given Tile is adjacent to the edge of the map.
 boolean isAdjacentToVerticalMapEdge(Tile tile)
          Checks if the given Tile is adjacent to the east or west edge of the map.
 boolean isLandWithinDistance(int x, int y, int distance)
          Searches for land within the given radius.
 boolean isValid(int x, int y)
          Checks whether a position is valid (within the map limits).
static boolean isValid(int x, int y, int width, int height)
          Checks if the given position is valid.
 boolean isValid(Map.Position position)
          Checks whether a position is valid (within the map limits).
static boolean isValid(Map.Position position, int width, int height)
          Checks whether a position is valid.
 PathNode search(Tile startTile, GoalDecider gd, CostDecider costDecider, int maxTurns)
          Finds a path to a goal determined by the given GoalDecider.
 PathNode search(Unit unit, GoalDecider gd, int maxTurns)
          Finds a path to a goal determined by the given GoalDecider.
 PathNode search(Unit unit, GoalDecider gd, int maxTurns, Unit carrier)
          Finds a path to a goal determined by the given GoalDecider.
 PathNode search(Unit unit, Tile startTile, GoalDecider gd, CostDecider costDecider, int maxTurns)
          Finds a path to a goal determined by the given GoalDecider.
 PathNode search(Unit unit, Tile startTile, GoalDecider gd, CostDecider costDecider, int maxTurns, Unit carrier)
          Finds a path to a goal determined by the given GoalDecider.
 PathNode search(Unit unit, Tile startTile, GoalDecider gd, int maxTurns)
          Finds a path to a goal determined by the given GoalDecider.
 PathNode search(Unit unit, Tile startTile, GoalDecider gd, int maxTurns, Unit carrier)
          Finds a path to a goal determined by the given GoalDecider.
 void setRegion(Region region)
          Describe setRegion method here.
 void setTile(Tile tile, int x, int y)
          Sets the given tile the the given coordinates.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObject
addToRemoveElement, dispose, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, setGame, setId, toSavedXML, toString, toXML, updateFreeColGameObject, updateID
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NUMBER_OF_DIRECTIONS

public static final int NUMBER_OF_DIRECTIONS

COST_INFINITY

public static final int COST_INFINITY
The infinity cost as used by findPath(Unit, Tile, Tile).

See Also:
Constant Field Values
Constructor Detail

Map

public Map(Game game,
           Tile[][] tiles)
Create a new Map from a collection of tiles.

Parameters:
game - The Game this map belongs to.
tiles - The 2D array of tiles.

Map

public Map(Game game,
           javax.xml.stream.XMLStreamReader in)
    throws javax.xml.stream.XMLStreamException
Create a new Map from an Element in a DOM-parsed XML-tree.

Parameters:
game - The Game this map belongs to.
in - The input stream containing the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

Map

public Map(Game game,
           java.lang.String id)
Initiates a new Map with the given ID. The object should later be initialized by calling either FreeColGameObject.readFromXML(XMLStreamReader) or FreeColObject.readFromXMLElement(Element).

Parameters:
game - The Game in which this object belong.
id - The unique identifier for this object.
Method Detail

getRegions

public java.util.Collection<Region> getRegions()

getRegion

public Region getRegion(java.lang.String id)
Returns the Region with the given ID.

Parameters:
id - a String value
Returns:
a Region value

getRegionByName

public Region getRegionByName(java.lang.String id)
Returns the Region with the given name.

Parameters:
id - a String value
Returns:
a Region value

setRegion

public void setRegion(Region region)
Describe setRegion method here.

Parameters:
region - a Region value

findPath

public PathNode findPath(Tile start,
                         Tile end,
                         Map.PathType type)
Finds a shortest path between the given tiles. The Tile at the end will not be checked against the options.

Important: This method will not include colonies in a possible path, and PathNode.getTurns(), PathNode.getTotalTurns() and PathNode.getMovesLeft() will all return -1 for the generated PathNodes.

Use findPath(Unit, Tile, Tile) whenever possible.

Parameters:
start - The Tile in which the path starts from.
end - The end of the path.
type - One of: Map.PathType.BOTH_LAND_AND_SEA, Map.PathType.BOTH_LAND_AND_SEA, Map.PathType.ONLY_LAND and Map.PathType.ONLY_SEA.
Returns:
A PathNode for the first tile in the path. Calling PathNode.getTile() on this object, will return the Tile right after the specified starting tile, and PathNode.getDirection() will return the direction you need to take in order to reach that tile. This method returns null if no path is found.
Throws:
java.lang.IllegalArgumentException - if either start or end are null.
See Also:
findPath(Unit, Tile, Tile), Unit.findPath(Tile)

findPath

public PathNode findPath(Unit unit,
                         Tile start,
                         Tile end)
Finds a shortest path between the given tiles. The Tile at the end will not be checked against the unit's legal moves.

Parameters:
unit - The Unit that should be used to determine whether or not a path is legal.
start - The Tile in which the path starts from.
end - The end of the path.
Returns:
A PathNode for the first tile in the path. Calling PathNode.getTile() on this object, will return the Tile right after the specified starting tile, and PathNode.getDirection() will return the direction you need to take in order to reach that tile. This method returns null if no path is found.
Throws:
java.lang.IllegalArgumentException - if either unit, start or end are null.
See Also:
findPath(Tile, Tile, PathType), Unit.findPath(Tile)

findPath

public PathNode findPath(Unit unit,
                         Tile start,
                         Tile end,
                         CostDecider costDecider)
Finds a shortest path between the given tiles. The Tile at the end will not be checked against the unit's legal moves.

Parameters:
unit - The Unit that should be used to determine whether or not a path is legal.
start - The Tile in which the path starts from.
end - The end of the path.
costDecider - The object responsible for determining the cost.
Returns:
A PathNode for the first tile in the path. Calling PathNode.getTile() on this object, will return the Tile right after the specified starting tile, and PathNode.getDirection() will return the direction you need to take in order to reach that tile. This method returns null if no path is found.
Throws:
java.lang.IllegalArgumentException - if either unit, start or end are null.
See Also:
findPath(Tile, Tile, PathType), Unit.findPath(Tile)

findPath

public PathNode findPath(Unit unit,
                         Tile start,
                         Tile end,
                         Unit carrier,
                         CostDecider costDecider)
Finds a shortest path between the given tiles. The Tile at the end will not be checked against the unit's legal moves.

Parameters:
unit - The Unit that should be used to determine whether or not a path is legal.
start - The Tile in which the path starts from.
end - The end of the path.
carrier - A carrier that currently holds the unit, or null if the unit is not presently on a carrier.
costDecider - The object responsible for determining the cost.
Returns:
A PathNode for the first tile in the path. Calling PathNode.getTile() on this object, will return the Tile right after the specified starting tile, and PathNode.getDirection() will return the direction you need to take in order to reach that tile. This method returns null if no path is found.
Throws:
java.lang.IllegalArgumentException - if either unit, start or end are null.
See Also:
findPath(Tile, Tile, PathType), Unit.findPath(Tile)

findPath

public PathNode findPath(Unit unit,
                         Tile start,
                         Tile end,
                         Unit carrier)
Finds a shortest path between the given tiles. The Tile at the end will not be checked against the unit's legal moves.

Parameters:
unit - The Unit that should be used to determine whether or not a path is legal.
start - The Tile in which the path starts from.
end - The end of the path.
carrier - A carrier that currently holds the unit, or null if the unit is not presently on a carrier.
Returns:
A PathNode for the first tile in the path. Calling PathNode.getTile() on this object, will return the Tile right after the specified starting tile, and PathNode.getDirection() will return the direction you need to take in order to reach that tile. This method returns null if no path is found.
Throws:
java.lang.IllegalArgumentException - if either unit, start or end are null.
See Also:
findPath(Tile, Tile, PathType), Unit.findPath(Tile)

search

public PathNode search(Unit unit,
                       GoalDecider gd,
                       int maxTurns)
Finds a path to a goal determined by the given GoalDecider.

A GoalDecider is typically defined inline to serve a specific need.

Parameters:
unit - The Unit to find the path for.
gd - The object responsible for determining whether a given PathNode is a goal or not.
maxTurns - The maximum number of turns the given Unit is allowed to move. This is the maximum search range for a goal.
Returns:
The path to a goal determined by the given GoalDecider.

search

public PathNode search(Unit unit,
                       Tile startTile,
                       GoalDecider gd,
                       int maxTurns)
Finds a path to a goal determined by the given GoalDecider.

A GoalDecider is typically defined inline to serve a specific need.

Parameters:
unit - The Unit to find the path for.
startTile - The Tile to start the search from.
gd - The object responsible for determining whether a given PathNode is a goal or not.
maxTurns - The maximum number of turns the given Unit is allowed to move. This is the maximum search range for a goal.
Returns:
The path to a goal determined by the given GoalDecider.

search

public PathNode search(Unit unit,
                       GoalDecider gd,
                       int maxTurns,
                       Unit carrier)
Finds a path to a goal determined by the given GoalDecider.

A GoalDecider is typically defined inline to serve a specific need.

Parameters:
unit - The Unit to find the path for.
gd - The object responsible for determining wether a given PathNode is a goal or not.
maxTurns - The maximum number of turns the given Unit is allowed to move. This is the maximum search range for a goal.
carrier - The carrier the unit is currently onboard or null if the unit is either not onboard a carrier or should not use the carrier while finding the path.
Returns:
The path to a goal determined by the given GoalDecider.

search

public PathNode search(Tile startTile,
                       GoalDecider gd,
                       CostDecider costDecider,
                       int maxTurns)
Finds a path to a goal determined by the given GoalDecider.

A GoalDecider is typically defined inline to serve a specific need.

Parameters:
startTile - The Tile to start the search from.
gd - The object responsible for determining whether a given PathNode is a goal or not.
costDecider - The object responsible for determining the cost.
maxTurns - The maximum number of turns the given Unit is allowed to move. This is the maximum search range for a goal.
Returns:
The path to a goal determined by the given GoalDecider.

search

public PathNode search(Unit unit,
                       Tile startTile,
                       GoalDecider gd,
                       CostDecider costDecider,
                       int maxTurns)
Finds a path to a goal determined by the given GoalDecider.

A GoalDecider is typically defined inline to serve a specific need.

Parameters:
unit - The Unit to find the path for.
startTile - The Tile to start the search from.
gd - The object responsible for determining whether a given PathNode is a goal or not.
costDecider - The object responsible for determining the cost.
maxTurns - The maximum number of turns the given Unit is allowed to move. This is the maximum search range for a goal.
Returns:
The path to a goal determined by the given GoalDecider.

search

public PathNode search(Unit unit,
                       Tile startTile,
                       GoalDecider gd,
                       int maxTurns,
                       Unit carrier)
Finds a path to a goal determined by the given GoalDecider.

A GoalDecider is typically defined inline to serve a specific need.

Parameters:
unit - an Unit value
startTile - The Tile to start the search from.
gd - The object responsible for determining whether a given PathNode is a goal or not.
maxTurns - The maximum number of turns the given Unit is allowed to move. This is the maximum search range for a goal.
carrier - The carrier the unit is currently onboard or null if the unit is either not onboard a carrier or should not use the carrier while finding the path.
Returns:
The path to a goal determined by the given GoalDecider.

search

public PathNode search(Unit unit,
                       Tile startTile,
                       GoalDecider gd,
                       CostDecider costDecider,
                       int maxTurns,
                       Unit carrier)
Finds a path to a goal determined by the given GoalDecider.

A GoalDecider is typically defined inline to serve a specific need.

Parameters:
unit - an Unit value
startTile - The Tile to start the search from.
gd - The object responsible for determining whether a given PathNode is a goal or not.
costDecider - The object responsible for determining the cost.
maxTurns - The maximum number of turns the given Unit is allowed to move. This is the maximum search range for a goal.
carrier - The carrier the unit is currently onboard or null if the unit is either not onboard a carrier or should not use the carrier while finding the path.
Returns:
The path to a goal determined by the given GoalDecider.

isAdjacentToMapEdge

public boolean isAdjacentToMapEdge(Tile tile)
Checks if the given Tile is adjacent to the edge of the map.

Parameters:
tile - The Tile to be checked.
Returns:
true if the given tile is at the edge of the map.

isAdjacentToVerticalMapEdge

public boolean isAdjacentToVerticalMapEdge(Tile tile)
Checks if the given Tile is adjacent to the east or west edge of the map.

Parameters:
tile - The Tile to be checked.
Returns:
true if the given tile is at the edge of the map.

findPathToEurope

public PathNode findPathToEurope(Unit unit,
                                 Tile start)
Finds the best path to Europe.

Parameters:
unit - The Unit that should be used to determine whether or not a path is legal.
start - The starting Tile.
Returns:
The path to the target or null if no target can be found.
See Also:
Europe

findPathToEurope

public PathNode findPathToEurope(Unit unit,
                                 Tile start,
                                 CostDecider costDecider)
Finds the best path to Europe.

Parameters:
unit - The Unit that should be used to determine whether or not a path is legal.
start - The starting Tile.
Returns:
The path to the target or null if no target can be found.
See Also:
Europe

findPathToEurope

public PathNode findPathToEurope(Tile start)
Finds the best path to Europe independently of any unit. This method is meant to be executed by the server/AI code, with complete knowledge of the map

Parameters:
start - The starting Tile.
Returns:
The path to the target or null if no target can be found.
See Also:
Europe

isLandWithinDistance

public boolean isLandWithinDistance(int x,
                                    int y,
                                    int distance)
Searches for land within the given radius.

Parameters:
x - X-component of the position to search from.
y - Y-component of the position to search from.
distance - The radius that should be searched for land, given in number of tiles.
Returns:
true if there is land within the given radius and false otherwise.

getTile

public Tile getTile(Map.Position p)
Returns the Tile at a requested position.

Parameters:
p - The position.
Returns:
The Tile at the given position.

getTile

public Tile getTile(int x,
                    int y)
Returns the Tile at position (x, y). 'x' specifies a column and 'y' specifies a row. (0, 0) is the Tile at the top-left corner of the Map.

Parameters:
x - The x-coordinate of the Tile.
y - The y-coordinate of the Tile.
Returns:
The Tile at position (x, y) or null if the position is invalid.

setTile

public void setTile(Tile tile,
                    int x,
                    int y)
Sets the given tile the the given coordinates.

Parameters:
x - The x-coordinate of the Tile.
y - The y-coordinate of the Tile.
tile - The Tile.

getWidth

public int getWidth()
Returns the width of this Map.

Returns:
The width of this Map.

getHeight

public int getHeight()
Returns the height of this Map.

Returns:
The height of this Map.

getDirection

public Map.Direction getDirection(Tile t1,
                                  Tile t2)
Returns the direction a unit needs to move in order to get from t1 to t2

Parameters:
t1 - The tile to move from.
t2 - The target tile if moving from t1 in the direction returned by this method.
Returns:
The direction you need to move from t1 in order to reach t2, or null if the two specified tiles are not neighbours.

getNeighbourOrNull

public Tile getNeighbourOrNull(Map.Direction direction,
                               Tile t)
Returns the neighbouring Tile of the given Tile in the given direction.

Parameters:
direction - The direction in which the neighbour is located given t.
t - The Tile to get a neighbour of.
Returns:
The neighbouring Tile of the given Tile in the given direction.

getNeighbourOrNull

public Tile getNeighbourOrNull(Map.Direction direction,
                               int x,
                               int y)
Returns the neighbouring Tile of the given Tile in the given direction.

Parameters:
direction - The direction in which the neighbour is located given the base tile.
x - The base tile X coordinate.
y - The base tile Y coordinate.
Returns:
The neighbouring Tile of the given coordinate in the given direction or null if invalid.

getSurroundingTiles

public java.util.List<Tile> getSurroundingTiles(Tile t,
                                                int range)
Returns all the tiles surrounding the given tile within the given range. The center tile itself is not included.

Parameters:
t - The tile that lies on the center of the tiles to return.
range - How far away do we need to go starting from the center tile.
Returns:
The tiles surrounding the given tile.

getWholeMapIterator

public Map.WholeMapIterator getWholeMapIterator()
Gets an Iterator of every Tile on the map.

Returns:
the Iterator.

getAdjacent

public static Map.Position getAdjacent(Map.Position position,
                                       Map.Direction direction)
Gets the position adjacent to a given position, in a given direction.

Parameters:
position - The position
direction - The direction (N, NE, E, etc.)
Returns:
Adjacent position

getAdjacentTile

public Tile getAdjacentTile(Map.Position position,
                            Map.Direction direction)
Gets the position adjacent Tile to a given Tile, in a given direction.

Parameters:
position - The position
direction - The direction (N, NE, E, etc.)
Returns:
Adjacent tile

getAdjacentIterator

public java.util.Iterator<Map.Position> getAdjacentIterator(Map.Position centerPosition)
Get an adjacent iterator.

Parameters:
centerPosition - The center position to iterate around
Returns:
Iterator

getBorderAdjacentIterator

public java.util.Iterator<Map.Position> getBorderAdjacentIterator(Map.Position centerPosition)
Get a border adjacent iterator.

Parameters:
centerPosition - The center position to iterate around
Returns:
Iterator

getFloodFillIterator

public java.util.Iterator<Map.Position> getFloodFillIterator(Map.Position centerPosition)
Get a flood fill iterator.

Parameters:
centerPosition - The center position to iterate around
Returns:
Iterator

getCircleIterator

public Map.CircleIterator getCircleIterator(Map.Position center,
                                            boolean isFilled,
                                            int radius)
Get a circle iterator.

Parameters:
center - The center position to iterate around
isFilled - True to get all of the positions in the circle
radius - Radius of circle
Returns:
Iterator

isValid

public boolean isValid(Map.Position position)
Checks whether a position is valid (within the map limits).

Parameters:
position - The position
Returns:
True if it is valid

isValid

public boolean isValid(int x,
                       int y)
Checks whether a position is valid (within the map limits).

Parameters:
x - X coordinate
y - Y coordinate
Returns:
True if it is valid

isValid

public static boolean isValid(Map.Position position,
                              int width,
                              int height)
Checks whether a position is valid.

Parameters:
position - The position
width - The width of the map.
height - The height of the map.
Returns:
true if the given position is within the bounds of the map and false otherwise

isValid

public static boolean isValid(int x,
                              int y,
                              int width,
                              int height)
Checks if the given position is valid.

Parameters:
x - The x-coordinate of the position.
y - The y-coordinate of the position.
width - The width of the map.
height - The height of the map.
Returns:
true if the given position is within the bounds of the map and false otherwise

getRandomLandPosition

public Map.Position getRandomLandPosition(java.util.Random random)
Select a random land position on the map. Warning: This method should not be used by any model object unless we have completed restructuring the model (making all model changes at the server). The reason is the use of random numbers in this method.

Parameters:
random - A Random number source.
Returns:
Position selected

getDistance

public int getDistance(Map.Position position1,
                       Map.Position position2)
Gets the distance in tiles between two map positions. With an isometric map this is a non-trivial task. The formula below has been developed largely through trial and error. It should cover all cases, but I wouldn't bet my life on it.

Parameters:
position1 - The first position.
position2 - The second position.
Returns:
Distance

getDistance

public int getDistance(int ax,
                       int ay,
                       int bx,
                       int by)
Gets the distance in tiles between two map positions.

Parameters:
ax - Position A x-coordinate
ay - Position A y-coordinate
bx - Position B x-coordinate
by - Position B y-coordinate
Returns:
Distance

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
the tag name.

getAllTiles

public java.lang.Iterable<Tile> getAllTiles()
Make the map usable as a parameter in the for-loop. Returns all Tiles based on the order of the WholeMapIterator.

Returns:
An Iterable that can be used to get an iterator for all tiles of the map.