20 package net.sf.gridarta.gui.map.mapactions;
22 import java.awt.Point;
23 import java.util.Iterator;
24 import java.util.NoSuchElementException;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
96 if (direction != -1 && direction != 1) {
97 throw new IllegalArgumentException();
102 point =
new Point(xStart, yStart);
103 start = exitMatcher.getValidExit(mapModel, point);
104 final Size2D mapSize = mapModel.getMapArchObject().getMapSize();
118 throw new NoSuchElementException();
120 findNextPending =
true;
125 public void remove() {
126 throw new UnsupportedOperationException();
133 if (!findNextPending) {
136 findNextPending =
false;
139 while (remainingMapSquares-- > 0) {
142 if (next != null && next != start) {
final int direction
The search direction:
final ExitMatcher< G, A, R > exitMatcher
The ExitMatcher for selecting exit game objects.
A MapModel reflects the data of a map.
An Iterator that returns all map squares containing an exit game object.
void nextPoint(Point point, int direction)
Moves the given point forward or backward one map square.
boolean findNextPending
Whether next is valid.
void findNext()
Updates next to the next match.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Selects valid exit game objects from maps.
GameObjects are the objects based on Archetypes found on maps.
G getValidExit(@NotNull final MapModel< G, A, R > mapModel, @NotNull final Point point)
Returns an exit game object on a given map square having exit information.
int getWidth()
Returns the width of the area.
ExitIterator(@NotNull final ExitMatcher< G, A, R > exitMatcher, @NotNull final MapModel< G, A, R > mapModel, final int xStart, final int yStart, final int direction)
Creates a new instance.
final MapModel< G, A, R > mapModel
The MapModel begin searched.
int remainingMapSquares
The number of map squares remaining to be searched.
final Point point
The current location on the map.
int getHeight()
Returns the height of the area.
final G start
The starting exit game object or.
G next
The next exit game object to return from next().
Interface for MapArchObjects.
The class Size2D represents a 2d rectangular area.