|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--de.uni_paderborn.robots.robot.group9.MapItem
Equivalent of one arena field in the robot's own map. Linked in four directions and also by a MapTree in class Map.
| Field Summary | |
private 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. |
private int |
bfsDistance
Distance value for breadth first search or dijsktra performed by Map for searching the shortest path to a map item |
private MapItem |
bfsPredecessor
Predecessor of this item in breadth first search. |
private short |
bfsState
State of this item in the currently performed breadth first search. |
static short |
BLOCKED_TELEPORT
This position contains a teleport whose linked teleport is probably blocked. |
static short |
CARD
This value marks wheter a card was on that position when it was seen |
private Map.Coordinate |
coordinate
Stores a xy coordinate of the map item. |
private int |
discoveredInRound
Number of round in which this field/map item has been discovered by the mapping method. |
private MapItem |
east
The MapItem to the east of this MapItem is linked here. 0..1 horizontal 0..1 MapItem -------------------------- MapItem east west |
static short |
EMPTY
On this position there is nothing (sometimes it may be occupied by a robot) |
private int |
examinedInRound
Number of round in which this field/map item has been examined by the mapping method. |
static short |
EXIT
This position is the exit of the arena |
private int |
id
For storing the field id of the arena fields |
private java.lang.Class |
itemClass
If this MapItem is an UNKNOWN_REACTABLE, the Class object of the MapItem is stored here, in order to be able to keep track of the reactable classes that cause damage to a robot |
private Map |
map
The Map this MapItem belongs to. /\ 0..1 items Map < >--------------------- MapItem \/ map |
private MapItem |
north
The MapItem to the north of this MapItem is linked here. 0..1 vertical 0..1 MapItem ------------------------ MapItem north south |
static short |
NOT_VISITED
This position has not been visited by the robot. |
private boolean |
notPassable
This field allows to explicitely declare this position as not passable, independantly from its type |
static short |
ROBOT
A robot has been found on this position. |
static short |
SLEEPING_ROBOT
A robot without energy has been found on this position. |
private MapItem |
south
The MapItem to the south of this MapItem is linked here. 0..1 vertical 0..1 MapItem ------------------------ MapItem south north |
static short |
TELEPORT
There is a teleporter on this position, whose "other side" is already known. |
private MapItem |
teleportLink
If this MapItem is a teleport, this field points to the other side of the teleport. |
private short |
type
For storing the type of the map item |
static short |
UNKNOWN_ITEM
There is some other unknown item on this position (not a reactable) |
static short |
UNKNOWN_REACTABLE
There is an unknown reactable on this position |
static short |
UNKNOWN_REACTABLE_BAD
This position contains an unknown reactable that is known to cause damage. |
static short |
UNKNOWN_REACTABLE_USED
This position contains an unknown reactable that has been already used. |
static short |
UNUSED_TELEPORT
This position contains a teleport that has not been explored, yet. |
static short |
WALL
This position is occupied by a wall |
static short |
WELL
There is an energy source (well) on this position |
private MapItem |
west
The MapItem to the west of this MapItem is linked here. 0..1 horizontal 0..1 MapItem -------------------------- MapItem west east |
| Constructor Summary | |
MapItem()
Creates a new map item and sets the id to -1 and type to NOT_VISITED |
|
| Method Summary | |
private static void |
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()
gets the addedToQueue value |
int |
getBfsDistance()
Gets bfsDistance. |
MapItem |
getBfsPredecessor()
Gets bfsPredecessor |
short |
getBfsState()
Gets bfsState |
Map.Coordinate |
getCoordinate()
Get this map item's coordinate |
(package private) int |
getDirectionOfMapItem(MapItem mapItem)
Gets the direction in which this map item is linked with the given map item. |
int |
getDiscoveredInRound()
Read access method for discoveredInRound. |
MapItem |
getEast()
Gets the MapItem in the east of this MapItem |
int |
getExaminedInRound()
Returns the number of round in which this field/map item has been examined by the mapping method. |
int |
getId()
Returns the id of this item |
java.lang.Class |
getItemClass()
Read access method for itemClass. |
Map |
getMap()
Gets this MapItem's map |
MapItem |
getMapItemByDirection(int direction)
Method similar to getNorth(), getSouth(), getWest(), getEast(). |
MapItem |
getNorth()
Gets the MapItem in the north of this MapItem |
int |
getPredecessorDirection()
Gets the direction the path predecessor is linked to this MapItem |
MapItem |
getSouth()
Gets the MapItem in the south of this MapItem |
MapItem |
getTeleportLink()
Gets the teleportLink |
short |
getType()
Gets this item's type. |
MapItem |
getWest()
Gets the MapItem in the west of this MapItem |
void |
insertMapItemByDirection(int direction,
MapItem mapItem)
Does 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 |
removeYou()
Removes the MapItem from the Map's MapItem graph. |
void |
setAddedToQueue(int addedToQueue)
sets the addedToQueue value |
void |
setBfsDistance(int bfsDistance)
Sets bfsDistance. |
void |
setBfsPredecessor(MapItem bfsPredecessor)
Sets bfsPredecessor |
void |
setBfsState(short bfsState)
Sets bfsState. |
void |
setBfsStateDistancePredecessor(short bfsState,
int bfsDistance,
MapItem bfsPredecessor)
Comined version of setBfsState(), setBfsDistance() and setBfsPredecessor(). |
void |
setCoordinate(Map.Coordinate coordinate)
Set this map item's coordinate |
boolean |
setEast(MapItem value)
Sets the to east link of this MapItem to the specified MapItem. |
void |
setExaminedInRound(int examinedInRound)
Set the examinedInRound value. |
void |
setId(int id)
Sets this item's id |
void |
setItemClass(java.lang.Class itemClass)
Write access method for itemClass. |
boolean |
setMap(Map value)
Sets this MapItem's map. |
void |
setMapItemByDirection(int direction,
MapItem mapItem)
Method similar to setNorth(), setSouth(), setWest(), setEast(). |
boolean |
setNorth(MapItem value)
Sets the to north link of this MapItem to the specified MapItem. |
void |
setNotPassable(boolean notPassable)
Write access method for notPassable. |
boolean |
setSouth(MapItem value)
Sets the to south link of this MapItem to the specified MapItem. |
void |
setTeleportLink(MapItem teleportLink)
Sets the teleportLink |
void |
setType(short type)
Sets this item's type. |
boolean |
setWest(MapItem value)
Sets the to west link of this MapItem to the specified MapItem. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private Map.Coordinate coordinate
private MapItem north
0..1 vertical 0..1
MapItem ------------------------ MapItem
north south
private MapItem south
0..1 vertical 0..1
MapItem ------------------------ MapItem
south north
private MapItem west
0..1 horizontal 0..1
MapItem -------------------------- MapItem
west east
private MapItem east
0..1 horizontal 0..1
MapItem -------------------------- MapItem
east west
private MapItem teleportLink
private java.lang.Class itemClass
private Map map
/\ 0..1 items
Map < >--------------------- MapItem
\/ map
private int id
private int addedToQueue
public static final short EMPTY
public static final short TELEPORT
public static final short WELL
public static final short EXIT
public static final short WALL
public static final short CARD
public static final short ROBOT
public static final short SLEEPING_ROBOT
public static final short UNKNOWN_REACTABLE
public static final short UNKNOWN_ITEM
public static final short NOT_VISITED
public static final short UNUSED_TELEPORT
public static final short BLOCKED_TELEPORT
public static final short UNKNOWN_REACTABLE_BAD
public static final short UNKNOWN_REACTABLE_USED
private short type
private boolean notPassable
private int examinedInRound
private int discoveredInRound
private int bfsDistance
public static final short BFS_UNKNOWN
public static final short BFS_VISITED
public static final short BFS_FINISHED
private short bfsState
private MapItem bfsPredecessor
| Constructor Detail |
public MapItem()
| Method Detail |
public void setCoordinate(Map.Coordinate coordinate)
coordinate - the new coordinate of this map itempublic Map.Coordinate getCoordinate()
public boolean setNorth(MapItem value)
value - the new north linkpublic MapItem getNorth()
public boolean setSouth(MapItem value)
value - the new south linkpublic MapItem getSouth()
public boolean setWest(MapItem value)
value - the new west linkpublic MapItem getWest()
public boolean setEast(MapItem value)
value - the new east linkpublic MapItem getEast()
public void removeYou()
public MapItem getMapItemByDirection(int direction)
direction - direction as defined in Robot.java
public void setMapItemByDirection(int direction,
MapItem mapItem)
direction - direction as defined in Robot.javaMapItem - MapItem to which this item will be linked in specified directionpublic void setTeleportLink(MapItem teleportLink)
teleportLink - the new teleport linkpublic MapItem getTeleportLink()
public java.lang.Class getItemClass()
public void setItemClass(java.lang.Class itemClass)
itemClass - the new value of itemClass
private static void fixItemLinks(int direction,
MapItem item,
MapItem relativeItem)
direction - direction relative to item how relativeItem is positioneditem - neighbour of relativeItem. relativeItem is in the specified direction of item.relativeItem - neighbour of item
public void insertMapItemByDirection(int direction,
MapItem mapItem)
direction - direction as defined in Robot.javaMapItem - MapItem to which this item will be linked in specified directionint getDirectionOfMapItem(MapItem mapItem)
mapItem - the map item to find the direction forpublic boolean setMap(Map value)
value - the new map.public Map getMap()
public void setId(int id)
id - the new id of this itempublic int getId()
public void setAddedToQueue(int addedToQueue)
addedToQueue - the new addedToQueue valuepublic int getAddedToQueue()
public void setType(short type)
the - new type of the itempublic short getType()
public void setNotPassable(boolean notPassable)
notPassable - new value for notPassable
public boolean isPassable(int gameRound,
int flags)
gameRound - the number of the current game round.public int getExaminedInRound()
public void setExaminedInRound(int examinedInRound)
examinedInRound - The round number in which this map item has been (re)examinedpublic int getDiscoveredInRound()
public void setBfsDistance(int bfsDistance)
bfsDistance - the new distancepublic int getBfsDistance()
public void setBfsState(short bfsState)
bfsState - the new bfsState. Can be one of BFS_UNKOWN, BFS_VISITED and BFS_FINISHED.public short getBfsState()
public void setBfsPredecessor(MapItem bfsPredecessor)
bfsPredecessor - the predecessor of this map item in breadth first searchpublic MapItem getBfsPredecessor()
public void setBfsStateDistancePredecessor(short bfsState,
int bfsDistance,
MapItem bfsPredecessor)
bfsState - new bfs statebfsDistance - new bfs distancebfsPredecessor - new bfs predecessorpublic int getPredecessorDirection()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||