movement.map
Class SimMap

java.lang.Object
  extended by movement.map.SimMap
All Implemented Interfaces:
java.io.Serializable

public class SimMap
extends java.lang.Object
implements java.io.Serializable

A simulation map for node movement.

See Also:
Serialized Form

Constructor Summary
SimMap(java.util.Map<Coord,MapNode> nodes)
           
 
Method Summary
 Coord getMaxBound()
          Returns the lower right corner coordinate of the map
 Coord getMinBound()
          Returns the upper left corner coordinate of the map
 MapNode getNodeByCoord(Coord c)
          Returns a MapNode at given coordinates or null if there's no MapNode in the location of the coordinate
 java.util.List<MapNode> getNodes()
          Returns all the map nodes in a list
 Coord getOffset()
          Returns the offset that has been caused by translates made to this map (does NOT take into account mirroring).
 boolean isMirrored()
          Returns true if this map has been mirrored after reading
 void mirror()
          Mirrors all map coordinates around X axis (x'=x, y'=-y).
 java.lang.String toString()
          Returns a String representation of the map
 void translate(double dx, double dy)
          Translate whole map by dx and dy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimMap

public SimMap(java.util.Map<Coord,MapNode> nodes)
Method Detail

getNodes

public java.util.List<MapNode> getNodes()
Returns all the map nodes in a list

Returns:
all the map nodes in a list

getNodeByCoord

public MapNode getNodeByCoord(Coord c)
Returns a MapNode at given coordinates or null if there's no MapNode in the location of the coordinate

Parameters:
c - The coordinate
Returns:
The map node in that location or null if it doesn't exist

getMinBound

public Coord getMinBound()
Returns the upper left corner coordinate of the map

Returns:
the upper left corner coordinate of the map

getMaxBound

public Coord getMaxBound()
Returns the lower right corner coordinate of the map

Returns:
the lower right corner coordinate of the map

getOffset

public Coord getOffset()
Returns the offset that has been caused by translates made to this map (does NOT take into account mirroring).

Returns:
The current offset

isMirrored

public boolean isMirrored()
Returns true if this map has been mirrored after reading

Returns:
true if this map has been mirrored after reading
See Also:
mirror()

translate

public void translate(double dx,
                      double dy)
Translate whole map by dx and dy

Parameters:
dx - The amount to translate X coordinates
dy - the amount to translate Y coordinates

mirror

public void mirror()
Mirrors all map coordinates around X axis (x'=x, y'=-y).


toString

public java.lang.String toString()
Returns a String representation of the map

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the map