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
-
ReadOnlyMap(Map)
- Once the constructor is called, all allowed calls will be
transmitted to the underlying map.
-
angleTowards(Position)
- Angle between (0,0) and the given position, in radians.
-
getBulletList()
- Returns a Vector containing a copy of all the bullets in the map
(of class Bullet).
-
getHeight()
- Returns the height of the map
-
getRobotList()
- Returns a Vector containing a copy of all the robots of the map
(of class RobotInfo).
-
getWallList()
- Returns a Vector containing a copy of all the walls of the map
(of class LinearMapObject), including the walls surrounding
the arena.
-
getWidth()
- Returns the width of the map
-
lineSegmentsIntersect(LinearMapObject, LinearMapObject)
- Returns true if the two line segments intersect
-
lineSegmentsTouch(LinearMapObject, LinearMapObject, double)
- Return true if the two line segment are separated by a distance
smaller than dist
-
lineSegmentTouches(LinearMapObject, Position, double)
- Returns true if the distance between the line segment and the point
is smaller than radius
-
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.
-
setBulletList(Vector)
- This method set the bullet list returned by getBulletList().
-
shortestTurn(double, double)
- Returns +/- (targetAngle-startAngle), depending on which
is shorter.
-
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.
-
touchesWall(Position, double)
-
Returns true if a linear object of internalList is at a distance
shorter than radius to the given position.
-
traversesWall(LinearMapObject)
- Returns true if the given line segment goes through a wall
-
traversesWall(LinearMapObject, double)
- Returns true if the given line segment goes through a wall
or comes to a distance closer than dist to it.
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.
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.
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.
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.
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.
getWidth
public double getWidth()
- Returns the width of the map
getHeight
public double getHeight()
- Returns the height of the map
lineSegmentsIntersect
public boolean lineSegmentsIntersect(LinearMapObject one,
LinearMapObject two)
- Returns true if the two line segments intersect
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
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
traversesWall
public boolean traversesWall(LinearMapObject traj)
- Returns true if the given line segment goes through a wall
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.
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.
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.
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.
angleTowards
public double angleTowards(Position target)
- Angle between (0,0) and the given position, in radians.
0=east.
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