20 package net.sf.gridarta.model.validation.checks;
22 import java.util.Arrays;
23 import java.util.Collection;
24 import java.util.HashSet;
34 import org.jetbrains.annotations.NotNull;
40 public class UnsetSlayingChecker<G
extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>> extends
AbstractValidator<G, A, R> implements
GameObjectValidator<G, A, R> {
46 private final Collection<Integer>
typeNumbers =
new HashSet<>();
60 super(validatorPreferences);
61 allowedValues.add(
"");
62 this.typeNumbers.addAll(Arrays.asList(typeNumbers));
70 allowedValues.add(value);
75 if (typeNumbers.contains(gameObject.getTypeNo())) {
76 final String slayingArchetype = gameObject.getArchetype().getAttributeString(
BaseObject.
SLAYING);
77 if (!allowedValues.contains(slayingArchetype)) {
79 if (slayingArchetype.equals(slayingObject)) {
This is the base class for validators.
Interface for GameObject Validators.
This package contains the framework for validating maps.
String SLAYING
The name of the "slaying" attribute.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
void addAllowedValue(@NotNull final String value)
Adds a value which does not trigger a warning.
Configuration parameters for Validators.
GameObjects are the objects based on Archetypes found on maps.
UnsetSlayingChecker(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final Integer... typeNumbers)
Create a new instance.
Validation error indicating a game object with a custom type.
Checks that a game object does not set a custom type.
final Collection< String > allowedValues
The values which do not trigger a warning.
void validateGameObject(@NotNull final G gameObject, @NotNull final ErrorCollector< G, A, R > errorCollector)
Validates a game object.
final Collection< Integer > typeNumbers
The object types to check.
final ValidatorPreferences validatorPreferences
The ValidatorPreferences to use.
An interface for classes that collect errors.
Interface for MapArchObjects.