20 package net.sf.gridarta.model.validation.checks;
22 import java.util.HashMap;
34 import org.jetbrains.annotations.NotNull;
41 public class DoubleLayerChecker<G
extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>> extends
AbstractValidator<G, A, R> implements
SquareValidator<G, A, R> {
48 super(validatorPreferences);
53 final Map<Integer, G> gameObjects =
new HashMap<>();
54 final Map<Integer, DoubleLayerError<G, A, R>> errors =
new HashMap<>();
55 for (
final G gameObject : mapSquare) {
61 if (existingError != null) {
64 final G existingGameObject = gameObjects.get(layer);
65 if (existingGameObject != null) {
67 errors.put(layer, error);
68 errorCollector.collect(error);
70 gameObjects.put(layer, gameObject);
This is the base class for validators.
This package contains the framework for validating maps.
static final String LAYER
The name of the "layer" attribute.
void validateSquare(@NotNull final MapSquare< G, A, R > mapSquare, @NotNull final ErrorCollector< G, A, R > errorCollector)
Validate a map square.
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.
Validation error that's used when the DoubleLayerChecker detected a possible error on the map...
final ValidatorPreferences validatorPreferences
The ValidatorPreferences to use.
A SquareValidator to assert that there are no two objects within the same layer.
void addGameObject(@NotNull final G gameObject)
An interface for classes that collect errors.
Default implementation for GameObject implementing classes.
DoubleLayerChecker(@NotNull final ValidatorPreferences validatorPreferences)
Creates a new instance.
Interface for MapArchObjects.
Interface for Square Validators.