|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.ie.cowbots.util.GridMap
T
- content typepublic class GridMap
basic class to model a two dimensional map. class is preliminary and subject to change!
Nested Class Summary | |
---|---|
private class |
GridMap.Coordinate
|
Field Summary | |
---|---|
(package private) java.util.ArrayList<java.util.ArrayList<GridCell<ELPLiteral>>> |
gridmap
|
(package private) int |
h
|
(package private) IdentTable |
idents
|
(package private) java.util.List<GridMap.Coordinate> |
movers
|
(package private) int |
w
|
Constructor Summary | |
---|---|
GridMap()
|
Method Summary | |
---|---|
ELPLiteral |
getBgnd(int x,
int y)
returns the type of a cell, or a null pointer. |
GridCell<ELPLiteral> |
getCell(int x,
int y)
|
ELPLiteral |
getContent(int x,
int y)
returns the "ison" predicate at a given (x,y) coordinate index |
DistanceMap |
getDistanceMap(boolean agentsAsObstacles)
returns the distance map associated with this grid map, and all obstacles are put on the map initially. you may optionally enable other things as obstacles. |
DistanceMap |
getDistanceMap(boolean agentsAsObstacles,
boolean closedFences)
returns a distance map, but closed fences are treated as obstacles (if 2nd argument set to true). |
int |
getFenceOpenTime(int x,
int y)
|
ELPLiteral |
getFlag(int x,
int y)
returns the "isopen" literal at a given location (x,y) |
java.util.List<ELPLiteral> |
getMoversByType(java.lang.String identPredicate)
returns a list of all moving objects by a given type |
int |
height()
returns the height, in tiles, of this map |
boolean |
isCorner(int x,
int y)
returns true if a cell has at least two adjacent obstacle or switch cells. used in the contest to prevent clustering cows that are in a corner. |
boolean |
isFence(int x,
int y)
|
void |
resetMovers()
resets all moving entities (removed from map) |
void |
saveAs(java.lang.String filename)
|
ELPLiteral |
setContent(int x,
int y,
ELPLiteral data)
|
void |
setDimension(int x,
int y)
|
void |
setDimensionContest(int x,
int y,
int minCX,
int minCY,
int maxCX,
int maxCY)
|
void |
setFlag(int x,
int y,
ELPLiteral data)
|
void |
setFlagNewer(int x,
int y,
ELPLiteral data,
int timeTerm)
this method updates a fence state depending the given data has a greater time value than the present one. |
void |
setGateState(java.util.List<java.awt.Point> fenceCells,
int fenceTimeMax,
java.lang.String fenceState)
|
void |
setIdentTable(IdentTable it)
|
void |
updateMovers(java.util.Collection<ELPLiteral> movingObjects)
updates cell content with moving entities |
int |
width()
returns the width, in tiles, of this map |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.util.ArrayList<java.util.ArrayList<GridCell<ELPLiteral>>> gridmap
int w
int h
java.util.List<GridMap.Coordinate> movers
IdentTable idents
Constructor Detail |
---|
public GridMap()
Method Detail |
---|
public void setIdentTable(IdentTable it)
public void setDimension(int x, int y)
public void setDimensionContest(int x, int y, int minCX, int minCY, int maxCX, int maxCY)
public void setFlag(int x, int y, ELPLiteral data)
public void setFlagNewer(int x, int y, ELPLiteral data, int timeTerm)
x
- y
- data
- timeTerm
- public ELPLiteral setContent(int x, int y, ELPLiteral data)
public ELPLiteral getContent(int x, int y)
x
- x-coordinatey
- y-coordinate
public ELPLiteral getBgnd(int x, int y)
x
- cell coordinatey
- cell coordinate
public ELPLiteral getFlag(int x, int y)
x
- x-coordinatey
- y-coordinate
public int width()
public int height()
public void resetMovers()
public void updateMovers(java.util.Collection<ELPLiteral> movingObjects)
movingObjects
- collection of moving entitiespublic GridCell<ELPLiteral> getCell(int x, int y)
public void saveAs(java.lang.String filename)
public java.util.List<ELPLiteral> getMoversByType(java.lang.String identPredicate)
identPredicate
-
public DistanceMap getDistanceMap(boolean agentsAsObstacles)
public DistanceMap getDistanceMap(boolean agentsAsObstacles, boolean closedFences)
agentsAsObstacles
- closedFences
-
public boolean isFence(int x, int y)
public boolean isCorner(int x, int y)
x
- y
-
public int getFenceOpenTime(int x, int y)
public void setGateState(java.util.List<java.awt.Point> fenceCells, int fenceTimeMax, java.lang.String fenceState)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |