All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ch.jp.robwar.ReadOnlyMap

java.lang.Object
   |
   +----ch.jp.robwar.ReadOnlyMap

public class ReadOnlyMap
extends Object
implements Serializable, Cloneable
The ReadOnlyMap class allows access to all read and helper functions of the Map class, but doesn't let you alter it.

See Also:
Map

Constructor Index

 o ReadOnlyMap(Map)
Once the constructor is called, all allowed calls will be transmitted to the underlying map.

Method Index

 o angleTowards(Position)
Angle between (0,0) and the given position, in radians.
 o getBulletList()
Returns a Vector containing a copy of all the bullets in the map (of class Bullet).
 o getHeight()
Returns the height of the map
 o getRobotList()
Returns a Vector containing a copy of all the robots of the map (of class RobotInfo).
 o getWallList()
Returns a Vector containing a copy of all the walls of the map (of class LinearMapObject), including the walls surrounding the arena.
 o getWidth()
Returns the width of the map
 o lineSegmentsIntersect(LinearMapObject, LinearMapObject)
Returns true if the two line segments intersect
 o lineSegmentsTouch(LinearMapObject, LinearMapObject, double)
Return true if the two line segment are separated by a distance smaller than dist
 o lineSegmentTouches(LinearMapObject, Position, double)
Returns true if the distance between the line segment and the point is smaller than radius
 o robotTouching(Position, double, int)
Returns the number of the robot that is at a distance less than radius from pos, and whose number is different from except.
 o setBulletList(Vector)
This method set the bullet list returned by getBulletList().
 o shortestTurn(double, double)
Returns +/- (targetAngle-startAngle), depending on which is shorter.
 o touchesObstacle(Position, double, int)
Returns true if an object, except the robot number exceptRobot is at a distance shorter than radius to the given position.
 o touchesWall(Position, double)
Returns true if a linear object of internalList is at a distance shorter than radius to the given position.
 o traversesWall(LinearMapObject)
Returns true if the given line segment goes through a wall
 o traversesWall(LinearMapObject, double)
Returns true if the given line segment goes through a wall or comes to a distance closer than dist to it.

Constructors

 o ReadOnlyMap
 public ReadOnlyMap(Map theMap) throws NullPointerException
Once the constructor is called, all allowed calls will be transmitted to the underlying map. Therefore, it is not necessary to rebuild the ReadOnlyMap if the Map changes.

Methods

 o setBulletList
 public void setBulletList(Vector newList)
This method set the bullet list returned by getBulletList(). It will not have any effect on the game and is only meant to be used internally.

 o getBulletList
 public Vector getBulletList()
Returns a Vector containing a copy of all the bullets in the map (of class Bullet). Modifying the list will not have any effect on the actual map.

 o getWallList
 public Vector getWallList()
Returns a Vector containing a copy of all the walls of the map (of class LinearMapObject), including the walls surrounding the arena. Modifying the list will not have any effect on the actual map.

 o getRobotList
 public Vector getRobotList()
Returns a Vector containing a copy of all the robots of the map (of class RobotInfo). Modifying the list will not have any effect on the actual game.

 o getWidth
 public double getWidth()
Returns the width of the map

 o getHeight
 public double getHeight()
Returns the height of the map

 o lineSegmentsIntersect
 public boolean lineSegmentsIntersect(LinearMapObject one,
                                      LinearMapObject two)
Returns true if the two line segments intersect

 o lineSegmentTouches
 public boolean lineSegmentTouches(LinearMapObject line,
                                   Position pos,
                                   double radius)
Returns true if the distance between the line segment and the point is smaller than radius

 o lineSegmentsTouch
 public boolean lineSegmentsTouch(LinearMapObject one,
                                  LinearMapObject two,
                                  double dist)
Return true if the two line segment are separated by a distance smaller than dist

 o traversesWall
 public boolean traversesWall(LinearMapObject traj)
Returns true if the given line segment goes through a wall

 o traversesWall
 public boolean traversesWall(LinearMapObject traj,
                              double dist)
Returns true if the given line segment goes through a wall or comes to a distance closer than dist to it.

 o touchesWall
 public boolean touchesWall(Position pos,
                            double radius)
Returns true if a linear object of internalList is at a distance shorter than radius to the given position.

 o robotTouching
 public int robotTouching(Position pos,
                          double radius,
                          int except)
Returns the number of the robot that is at a distance less than radius from pos, and whose number is different from except. If there is no such robot, returns -1.

 o touchesObstacle
 public boolean touchesObstacle(Position pos,
                                double radius,
                                int exceptRobot)
Returns true if an object, except the robot number exceptRobot is at a distance shorter than radius to the given position.

 o angleTowards
 public double angleTowards(Position target)
Angle between (0,0) and the given position, in radians. 0=east.

 o shortestTurn
 public double shortestTurn(double startAngle,
                            double targetAngle)
Returns +/- (targetAngle-startAngle), depending on which is shorter. The angles given in parameter can have any value; the return value will be between -Pi and Pi.


All Packages  Class Hierarchy  This Package  Previous  Next  Index
1