20 package net.sf.gridarta.model.validation.checks;
22 import java.awt.Point;
32 import org.jetbrains.annotations.NotNull;
40 public abstract class AbstractShopSquareChecker<G
extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>> extends
AbstractValidator<G, A, R> implements
MapValidator<G, A, R> {
47 super(validatorPreferences);
59 final Size2D mapSize = mapModel.getMapArchObject().getMapSize();
60 final int mapWidth = mapSize.
getWidth();
61 final int mapHeight = mapSize.
getHeight();
62 final boolean[][] matchingSquares =
new boolean[mapWidth][mapHeight];
63 final Point point =
new Point();
64 for (point.x = 0; point.x < mapWidth; point.x++) {
65 for (point.y = 0; point.y < mapHeight; point.y++) {
66 matchingSquares[point.x][point.y] =
isMatching(mapModel.getMapSquare(point), matcher);
69 return matchingSquares;
81 if (matcher.isMatching(gameObject.getHead())) {
A MapModel reflects the data of a map.
This is the base class for validators.
Interface for classes that match GameObjects.
This package contains classes related to matching GameObjects, so called GameObjectMatchers.
This package contains the framework for validating maps.
Interface for Map Validators.
boolean isMatching(@NotNull final Iterable< G > mapSquare, @NotNull final GameObjectMatcher matcher)
Returns whether a map square contains a game object matching a given GameObjectMatcher.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Configuration parameters for Validators.
GameObjects are the objects based on Archetypes found on maps.
int getWidth()
Returns the width of the area.
boolean [][] findMatchingSquares(@NotNull final MapModel< G, A, R > mapModel, @NotNull final GameObjectMatcher matcher)
Returns a.
final ValidatorPreferences validatorPreferences
The ValidatorPreferences to use.
A MapValidator to detect shop squares which allow magic or prayers, or which have adjacent squares th...
AbstractShopSquareChecker(@NotNull final ValidatorPreferences validatorPreferences)
Creates a new instance.
int getHeight()
Returns the height of the area.
Interface for MapArchObjects.
The class Size2D represents a 2d rectangular area.