20 package net.sf.gridarta.model.validation.checks;
22 import java.util.HashMap;
33 import org.jetbrains.annotations.NotNull;
40 public class DoubleTypeChecker<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> {
47 super(validatorPreferences);
52 final Map<Integer, G> gameObjects =
new HashMap<>();
53 final Map<Integer, DoubleTypeError<G, A, R>> errors =
new HashMap<>();
54 for (
final G gameObject : mapSquare) {
55 final Integer typeNo = gameObject.getTypeNo();
57 if (existingError != null) {
60 final G existingGameObject = gameObjects.get(typeNo);
61 if (existingGameObject != null) {
63 errors.put(typeNo, error);
64 errorCollector.collect(error);
66 gameObjects.put(typeNo, gameObject);
This is the base class for validators.
This package contains the framework for validating maps.
void addGameObject(@NotNull final G gameObject)
Base package of all Gridarta classes.
Reflects a game object (object on a map).
A SquareValidator to assert that there are no two arches of the same type on the same square...
Configuration parameters for Validators.
GameObjects are the objects based on Archetypes found on maps.
DoubleTypeChecker(@NotNull final ValidatorPreferences validatorPreferences)
Creates a new instance.
final ValidatorPreferences validatorPreferences
The ValidatorPreferences to use.
An interface for classes that collect errors.
Validation error that's used when the DoubleTypeChecker detected a possible error on the map...
void validateSquare(@NotNull final MapSquare< G, A, R > mapSquare, @NotNull final ErrorCollector< G, A, R > errorCollector)
Validate a map square.
Interface for MapArchObjects.
Interface for Square Validators.