20 package net.sf.gridarta.model.validation.checks;
22 import java.util.HashMap;
23 import java.util.IdentityHashMap;
33 import org.jetbrains.annotations.NotNull;
39 public class AttributeRangeChecker<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> {
45 private final Map<Integer, Type<G, A, R>>
types =
new HashMap<>();
51 private final Map<GameObjectMatcher, Type<G, A, R>>
matchers =
new IdentityHashMap<>();
71 public void add(
final int type, @NotNull
final String
name, @NotNull
final String displayName,
final int minValue,
final int maxValue)
throws InvalidCheckException {
72 if (minValue == Integer.MIN_VALUE && maxValue == Integer.MAX_VALUE) {
90 if (minValue == Integer.MIN_VALUE && maxValue == Integer.MAX_VALUE) {
105 if (oldType !=
null) {
110 types.put(type, newType);
122 if (oldType !=
null) {
133 if (!gameObject.isHead()) {
138 if (e.getKey().isMatching(gameObject)) {
139 e.getValue().validate(gameObject, errorCollector);
148 type.
validate(gameObject, errorCollector);