|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--de.uni_paderborn.robots.robot.group10.MapItem
The equivalent of one arena field in the robot's own map. Linked in six directions and also by a MapTree in class Map.
| Field Summary | |
protected int |
addedToQueue
The Dijkstra algorithm needs to keep track when this map item has been added to its priority queue. |
static short |
BFS_FINISHED
Value for bfsState. |
static short |
BFS_UNKNOWN
Value for bfsState. |
static short |
BFS_VISITED
Value for bfsState. |
protected int |
bfsDistance
Distance value for breadth first search or the dijsktra algorithm performed by Map for searching the shortest path to a map item. |
protected MapItem |
bfsPredecessor
Predecessor of this item in breadth first search. |
protected short |
bfsState
State of this item in the currently performed breadth first search. |
static short |
BLOCKED_WORMHOLE
This position contains a wormhole whose linked wormhole is probably blocked. |
static short |
CARD
This value marks whether a card was on that position when it was seen. |
protected Map.Coordinate |
coordinate
The (x/y)-coordinate of the map item.
|
protected int |
discoveredInRound
Number of rounds in which this map item has been discovered by the mapping method. |
static short |
EMPTY
On this position there is nothing (sometimes it may be occupied by a robot). |
protected int |
examinedInRound
Number of rounds in which this map item has been examined by the mapping method. |
static short |
EXIT
This position is the exit of the arena. |
protected int |
id
The id of this field in the arena. |
protected Map |
map
The Map this MapItem belongs to. |
protected MapItem |
north
Link to the MapItem to the north of this MapItem. |
protected MapItem |
northEast
Link to the MapItem to the north east of this MapItem. |
protected MapItem |
northWest
Link to the MapItem to the north west of this MapItem. |
static short |
NOT_VISITED
This position has not been visited by the robot. |
protected boolean |
notPassable
Explicitely declares this item as not passable, independantly from its type |
static short |
RECHARGER
There is an energy source (recharger) on this position. |
static short |
ROBOT
A robot has been found on this position. |
protected int |
robotCounter
Number of visits, the robot saw another robot on this field. |
static short |
SLEEPING_ROBOT
A robot without energy has been found on this position. |
protected MapItem |
south
Link to the MapItem to the south of this MapItem. |
protected MapItem |
southEast
Link to the MapItem to the south east of this MapItem. |
protected MapItem |
southWest
Link to the MapItem to the south west of this MapItem. |
protected short |
type
The type of the map item. |
static short |
UNUSED_WORMHOLE
This position contains a wormhole that has not been explored yet. |
static short |
WALL
This position is occupied by a wall. |
static short |
WORMHOLE
There is a wormhole on this position, whose "other side" is already known. |
protected MapItem |
wormholeLink
If this MapItem is a wormhole, this field points to the other side of the wormhole. |
| Constructor Summary | |
MapItem()
Creates a new map item. |
|
| Method Summary | |
protected static boolean |
fixItemLinks(int direction,
MapItem item,
MapItem relativeItem)
Checks that item and relativeItem, which are supposed to be neighbours, are correctly linked in the specified direction. |
int |
getAddedToQueue()
Returns the addedToQueue value |
int |
getBfsDistance()
Returns the value of bfsDistance. |
MapItem |
getBfsPredecessor()
Returns the value of bfsPredecessor. |
short |
getBfsState()
Returns the value of bfsState. |
Map.Coordinate |
getCoordinate()
Returns this map item's coordinate. |
int |
getDirectionOfMapItem(MapItem mapItem)
Returns the direction in which this map item is linked with the given map item. |
int |
getDiscoveredInRound()
Returns the number of rounds in which this map item has been discovered by the mapping method. |
int |
getExaminedInRound()
Returns the number of rounds in which this map item has been examined by the mapping method. |
int |
getId()
Returns the id of this item |
Map |
getMap()
Returns this MapItem's map |
MapItem |
getMapItemByDirection(int direction)
Returns the MapItem situated in the specified direction of this MapItem |
MapItem |
getNorth()
Returns the MapItem to the north of this MapItem |
MapItem |
getNorthEast()
Returns the MapItem to the north east of this MapItem |
MapItem |
getNorthWest()
Returns the MapItem to the north west of this MapItem |
boolean |
getNotPassable()
Returns whether this item is passable. |
int |
getPredecessorDirection()
Returns the direction of the link from the predecessor in the path to this map item. |
int |
getRobotCounter()
returns the robotCounter |
MapItem |
getSouth()
Returns the MapItem to the south of this MapItem |
MapItem |
getSouthEast()
Returns the MapItem to the south east of this MapItem |
MapItem |
getSouthWest()
Returns the MapItem to the south west of this MapItem |
short |
getType()
Returns this item's type. |
MapItem |
getWormholeLink()
Returns the wormhole link of this map item |
void |
insertMapItemByDirection(int direction,
MapItem mapItem)
The same as setMapItemByDirection(), but also sets the links of the new map item in all other directions to the correct values. |
boolean |
isPassable(int gameRound,
int flags)
Checks whether this map item can be passed. |
void |
removeYourself()
Removes the MapItem from the map's MapItem graph. |
void |
setAddedToQueue(int addedToQueue)
Sets the addedToQueue value |
void |
setBfsDistance(int bfsDistance)
Sets the value of bfsDistance. |
void |
setBfsPredecessor(MapItem bfsPredecessor)
Sets the value of bfsPredecessor. |
void |
setBfsState(short bfsState)
Sets the value of bfsState. |
void |
setBfsStateDistancePredecessor(short bfsState,
int bfsDistance,
MapItem bfsPredecessor)
Combined version of setBfsState(), setBfsDistance() and setBfsPredecessor(). |
void |
setCoordinate(Map.Coordinate coordinate)
Sets this map item's coordinate. |
void |
setDiscoveredInRound(int discoveredInRound)
Sets the number of rounds in which this map item has been discovered by the mapping method. |
void |
setExaminedInRound(int examinedInRound)
Sets the number of rounds in which this map item has been (re)examined by the mapping method. |
void |
setId(int id)
Sets this item's id |
boolean |
setMap(Map value)
Sets this MapItem's map. |
void |
setMapItemByDirection(int direction,
MapItem mapItem)
Sets the MapItem situated in the specified direction of this MapItem |
boolean |
setNorth(MapItem value)
Sets the to north link of this MapItem to the specified MapItem. |
boolean |
setNorthEast(MapItem value)
Sets the to north east link of this MapItem to the specified MapItem. |
boolean |
setNorthWest(MapItem value)
Sets the to north west link of this MapItem to the specified MapItem. |
void |
setNotPassable(boolean notPassable)
Sets whether this item is passable. |
void |
setRobotCounter(int value)
increments the robotCounter |
boolean |
setSouth(MapItem value)
Sets the to south link of this MapItem to the specified MapItem. |
boolean |
setSouthEast(MapItem value)
Sets the to south east link of this MapItem to the specified MapItem. |
boolean |
setSouthWest(MapItem value)
Sets the to south west link of this MapItem to the specified MapItem. |
void |
setType(short type)
Sets this item's type. |
boolean |
setWormholeLink(MapItem value)
Sets the wormhole link of this map item |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final short EMPTY
public static final short WORMHOLE
public static final short RECHARGER
public static final short EXIT
public static final short WALL
public static final short CARD
public static final short ROBOT
getExaminedInRound().
Obviously, the map item this robot then sits on is not marked with ROBOT, but with EMPTY.public static final short SLEEPING_ROBOT
public static final short NOT_VISITED
public static final short UNUSED_WORMHOLE
public static final short BLOCKED_WORMHOLE
public static final short BFS_UNKNOWN
public static final short BFS_VISITED
public static final short BFS_FINISHED
protected int id
protected short type
protected Map.Coordinate coordinate
(x/y)-coordinate of the map item.
This may change during arena exploration.protected Map map
protected MapItem north
protected MapItem northEast
protected MapItem southEast
protected MapItem south
protected MapItem southWest
protected MapItem northWest
protected MapItem wormholeLink
protected boolean notPassable
protected int discoveredInRound
protected int examinedInRound
protected int robotCounter
protected int addedToQueue
protected int bfsDistance
protected short bfsState
protected MapItem bfsPredecessor
| Constructor Detail |
public MapItem()
| Method Detail |
public int getId()
public void setId(int id)
id - the new id of this itempublic int getRobotCounter()
public void setRobotCounter(int value)
public short getType()
public void setType(short type)
type - the new type of the itempublic Map.Coordinate getCoordinate()
public void setCoordinate(Map.Coordinate coordinate)
coordinate - the new coordinate of this map itempublic Map getMap()
public boolean setMap(Map value)
value - the new map.public MapItem getNorth()
public boolean setNorth(MapItem value)
value - the new north linkpublic MapItem getNorthEast()
public boolean setNorthEast(MapItem value)
value - the new north east linkpublic MapItem getSouthEast()
public boolean setSouthEast(MapItem value)
value - the new south east linkpublic MapItem getSouth()
public boolean setSouth(MapItem value)
value - the new south linkpublic MapItem getSouthWest()
public boolean setSouthWest(MapItem value)
value - the new south west linkpublic MapItem getNorthWest()
public boolean setNorthWest(MapItem value)
value - the new north west linkpublic MapItem getWormholeLink()
public boolean setWormholeLink(MapItem value)
value - link the new wormhole linkpublic boolean getNotPassable()
public void setNotPassable(boolean notPassable)
notPassable - new value for notPassablepublic int getDiscoveredInRound()
public void setDiscoveredInRound(int discoveredInRound)
discoveredInRound - the number of rounds in which this map item has been discoveredpublic int getExaminedInRound()
public void setExaminedInRound(int examinedInRound)
examinedInRound - the number of rounds in which this map item has been (re)examinedpublic int getAddedToQueue()
public void setAddedToQueue(int addedToQueue)
addedToQueue - the new addedToQueue valuepublic int getBfsDistance()
public void setBfsDistance(int bfsDistance)
bfsDistance - the new distancepublic short getBfsState()
public void setBfsState(short bfsState)
bfsState - the new value of bfsStatepublic MapItem getBfsPredecessor()
public void setBfsPredecessor(MapItem bfsPredecessor)
bfsPredecessor - the predecessor of this map item in breadth first searchpublic void removeYourself()
public MapItem getMapItemByDirection(int direction)
direction - the direction in which to obtain the neighbouring field
public void setMapItemByDirection(int direction,
MapItem mapItem)
direction - the direction in which to set the neighbouring fieldMapItem - the new MapItem to which this item is to be linked in specified direction
public void insertMapItemByDirection(int direction,
MapItem mapItem)
setMapItemByDirection(), but also sets the links of the new map item in all other directions to the correct values.direction - the direction in which to set the neighbouring fieldMapItem - the new MapItem to which this item is to be linked in specified directionpublic int getDirectionOfMapItem(MapItem mapItem)
mapItem - the map item to find the direction for
protected static boolean fixItemLinks(int direction,
MapItem item,
MapItem relativeItem)
direction - direction in which relativeItem is positioned relative to itemitem - the item used as reference pointrelativeItem - neighbouring item in the specified direction
public boolean isPassable(int gameRound,
int flags)
setNotPassable().
This method does not return true for wormholes. These have to be treated as a special case.gameRound - the number of the current game round
public void setBfsStateDistancePredecessor(short bfsState,
int bfsDistance,
MapItem bfsPredecessor)
setBfsState(), setBfsDistance() and setBfsPredecessor().bfsState - new value of bfsStatebfsDistance - new value of bfsDistancebfsPredecessor - new value of bfsPredecessorpublic int getPredecessorDirection()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||