|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectgecco.server.automaton.AutomatonMap
This class manages the map of automatons. It can create a map given an image.
| Field Summary | |
byte[] |
initialMapRGB
The size of this array is 3*xsize*ysize. |
Automaton[][] |
theMap
The map |
| Constructor Summary | |
AutomatonMap(Class automatonClass,
int width,
int height)
Constructor for the AutomatonMap object |
|
AutomatonMap(Class automatonClass,
int width,
int height,
byte[] map,
HashMap colorToState)
Constructor for the AutomatonMap object |
|
AutomatonMap(Class automatonClass,
int width,
int height,
Image map,
HashMap colorToState)
Constructor for the AutomatonMap object |
|
AutomatonMap(Class automatonClass,
int width,
int height,
Reader map)
Constructor for the AutomatonMap object |
|
AutomatonMap(Class automatonClass,
int width,
int height,
String imageFileName,
HashMap colorToState)
Constructor for the AutomatonMap object |
|
AutomatonMap(Class automatonClass,
int width,
int height,
URL map,
HashMap colorToState)
Constructor for the AutomatonMap object |
|
| Method Summary | |
boolean |
areValidCoordinates(int x,
int y)
Returns true if the given coordinates exist on the map. |
Automaton |
getAutomaton(int x,
int y)
Gets an automaton at a given location. |
int |
getHeight()
The height of the automaton grid. |
byte[] |
getInitialMap()
Gets the InitialMap attribute of the AutomatonMap object |
protected Color |
getNearestColor(HashMap colorToState,
Color color)
Gets the nearest color that exists on the map, given a certain color. |
int[][] |
getNeighbourStates(int centerX,
int centerY)
Gets the states of the automatons at a 3x3 region around a given location. |
int |
getWidth()
The width of the automaton grid. |
protected void |
initMap(Image map,
HashMap colorToState)
Allocates all automatons on the map. |
protected void |
initMap(String map)
Allocates all automatons on the map. |
void |
setImage(byte[] map,
HashMap colorToState)
Sets the Image attribute of the AutomatonMap object |
void |
setImage(Image map,
HashMap colorToState)
Sets the Image attribute of the AutomatonMap object |
void |
setImage(Reader stream)
Sets the Image attribute of the AutomatonMap object, by reading characters from a stream. |
void |
setImage(String imageFileName,
HashMap colorToState)
Sets the Image attribute of the AutomatonMap object |
void |
setImage(URL mapURL,
HashMap colorToState)
Sets the Image attribute of the AutomatonMap object |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public Automaton[][] theMap
public byte[] initialMapRGB
| Constructor Detail |
public AutomatonMap(Class automatonClass,
int width,
int height)
width - The width of the map.height - The height of the map.automatonClass - The implemented automaton class.
public AutomatonMap(Class automatonClass,
int width,
int height,
URL map,
HashMap colorToState)
width - The width of the map.height - The height of the map.map - The map image.colorToState - The color conversion function.
public AutomatonMap(Class automatonClass,
int width,
int height,
Image map,
HashMap colorToState)
width - The width of the map.height - The height of the map.map - The map image.colorToState - The color conversion function.automatonClass - The implemented automaton class.
public AutomatonMap(Class automatonClass,
int width,
int height,
Reader map)
width - The width of the map.height - The height of the map.map - The map image.automatonClass - The implemented automaton class.
public AutomatonMap(Class automatonClass,
int width,
int height,
byte[] map,
HashMap colorToState)
width - The width of the map.height - The height of the map.map - The map image.colorToState - The color conversion function.automatonClass - The implemented automaton class.
public AutomatonMap(Class automatonClass,
int width,
int height,
String imageFileName,
HashMap colorToState)
width - The width of the map.height - The height of the map.imageFileName - The map image.colorToState - The color conversion function.automatonClass - The implemented automaton class.| Method Detail |
public void setImage(URL mapURL,
HashMap colorToState)
mapURL - The new Image valuecolorToState - The color conversion function.
public void setImage(Image map,
HashMap colorToState)
map - The new Image valuecolorToState - The color conversion function.
public void setImage(byte[] map,
HashMap colorToState)
map - The new Image valuecolorToState - The color conversion function.
public void setImage(String imageFileName,
HashMap colorToState)
imageFileName - The new Image valuecolorToState - The color conversion function.public void setImage(Reader stream)
stream - The stream to get characters frompublic byte[] getInitialMap()
public Automaton getAutomaton(int x,
int y)
throws IllegalArgumentException
x - The x coordinate.y - The y coordinate.
IllegalArgumentException - if the location does not exist.
public int[][] getNeighbourStates(int centerX,
int centerY)
centerX - The x coordinate of the center automaton.centerY - The x coordinate of the center automaton.
public int getWidth()
public int getHeight()
public boolean areValidCoordinates(int x,
int y)
x - The x coordinate to check.y - The x coordinate to check.
protected Color getNearestColor(HashMap colorToState,
Color color)
colorToState - The color conversion function.color - The color to check.
protected void initMap(Image map,
HashMap colorToState)
map - The map image.colorToState - The color conversion function.protected void initMap(String map)
map - The map.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||