|
Gridarta Editor
|
A rectangular grid of MapSquare instances. More...
Inheritance diagram for net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
Collaboration diagram for net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:Public Member Functions | |
| void | clearMap () |
| This implementation is very safe by recreating every single MapSquare as new empty square with the trade-off of some strain of the garbage-collector. More... | |
| void | collectHeads (final int minX, final int minY, final int maxX, final int maxY, @NotNull final Collection< GameObject< G, A, R >> objectsToDelete) |
| Adds all head parts for game object within an area to a collection. More... | |
| Size2D | getMapSize () |
| Returns the size of this map grid in map squares. More... | |
| MapSquare< G, A, R > | getMapSquare (final int x, final int y) |
| Returns the MapSquare at a given location. More... | |
| boolean | isEmpty () |
| Returns whether the map is empty. More... | |
| MapSquareGrid (@NotNull final MapModel< G, A, R > mapModel, @NotNull final Size2D mapSize) | |
| Creates a new instance. More... | |
| void | resize (@NotNull final Size2D newSize) |
| Resizes the map grid to a new size. More... | |
Private Member Functions | |
| List< List< MapSquare< G, A, R > > > | newMapGrid (@NotNull final Size2D mapSize) |
| Allocates a new 2-dimensional MapSquare array of the given size. More... | |
Private Attributes | |
| List< List< MapSquare< G, A, R > > > | mapGrid |
| The MapSquare of this grid. More... | |
| final MapModel< G, A, R > | mapModel |
| The associated MapModel. More... | |
| Size2D | mapSize |
| The size of mapGrid. More... | |
Static Private Attributes | |
| static final long | serialVersionUID = 1L |
| The serial version UID. More... | |
A rectangular grid of MapSquare instances.
Definition at line 36 of file MapSquareGrid.java.
| net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.MapSquareGrid | ( | @NotNull final MapModel< G, A, R > | mapModel, |
| @NotNull final Size2D | mapSize | ||
| ) |
Creates a new instance.
| mapModel | the associated map model |
| mapSize | the map size |
Definition at line 69 of file MapSquareGrid.java.
| void net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.clearMap | ( | ) |
This implementation is very safe by recreating every single MapSquare as new empty square with the trade-off of some strain of the garbage-collector.
An alternative implementation would manually clean every existing MapSquare but that probably wouldn't really be faster until we have reuse of GameObject instances similar to J2EE.
Definition at line 119 of file MapSquareGrid.java.
Here is the caller graph for this function:| void net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.collectHeads | ( | final int | minX, |
| final int | minY, | ||
| final int | maxX, | ||
| final int | maxY, | ||
| @NotNull final Collection< GameObject< G, A, R >> | objectsToDelete | ||
| ) |
Adds all head parts for game object within an area to a collection.
| minX | the x coordinate of the left border of the area |
| minY | the y coordinate of the top border of the area |
| maxX | the x coordinate of the right border of the area |
| maxY | the y coordinate of the bottom border of the area |
| objectsToDelete | the collection where the heads are added to |
Definition at line 184 of file MapSquareGrid.java.
Here is the caller graph for this function:| Size2D net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapSize | ( | ) |
Returns the size of this map grid in map squares.
Definition at line 199 of file MapSquareGrid.java.
Here is the caller graph for this function:| MapSquare<G, A, R> net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapSquare | ( | final int | x, |
| final int | y | ||
| ) |
Returns the MapSquare at a given location.
| x | the location's x coordinate |
| y | the location's y coordinate |
| IndexOutOfBoundsException | if the location is not within bounds |
Definition at line 108 of file MapSquareGrid.java.
Referenced by net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addGameObjectToMap(), net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapSquare(), net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.insertArchToMap(), net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.insertBaseObject(), and net.sf.gridarta.model.mapmodel.DefaultMapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isMultiArchFittingToMap().
Here is the caller graph for this function:| boolean net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isEmpty | ( | ) |
Returns whether the map is empty.
Definition at line 142 of file MapSquareGrid.java.
Here is the caller graph for this function:
|
private |
Allocates a new 2-dimensional MapSquare array of the given size.
| mapSize | the size |
Definition at line 86 of file MapSquareGrid.java.
Referenced by net.sf.gridarta.model.mapmodel.MapSquareGrid< G, A, R >.MapSquareGrid(), and net.sf.gridarta.model.mapmodel.MapSquareGrid< G, A, R >.resize().
Here is the caller graph for this function:| void net.sf.gridarta.model.mapmodel.MapSquareGrid< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.resize | ( | @NotNull final Size2D | newSize | ) |
Resizes the map grid to a new size.
| newSize | the new size |
Definition at line 157 of file MapSquareGrid.java.
Here is the caller graph for this function:
|
private |
The MapSquare of this grid.
Definition at line 62 of file MapSquareGrid.java.
|
private |
The associated MapModel.
Definition at line 48 of file MapSquareGrid.java.
Referenced by net.sf.gridarta.model.mapmodel.MapSquareGrid< G, A, R >.MapSquareGrid().
|
private |
The size of mapGrid.
Definition at line 55 of file MapSquareGrid.java.
Referenced by net.sf.gridarta.model.mapmodel.MapSquareGrid< G, A, R >.getMapSize(), and net.sf.gridarta.model.mapmodel.MapSquareGrid< G, A, R >.MapSquareGrid().
|
staticprivate |
The serial version UID.
Definition at line 41 of file MapSquareGrid.java.