Class AttributeRangeChecker<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.model.validation.AbstractValidator<G,A,R>
-
- net.sf.gridarta.model.validation.checks.AttributeRangeChecker<G,A,R>
-
- All Implemented Interfaces:
GameObjectValidator<G,A,R>,Validator<G,A,R>
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>
A validator that checks for suspicious attribute values.
-
-
Constructor Summary
Constructors Constructor Description AttributeRangeChecker(@NotNull ValidatorPreferences validatorPreferences)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int type, @NotNull java.lang.String name, @NotNull java.lang.String displayName, int minValue, int maxValue)Adds an attribute to check.voidadd(@NotNull GameObjectMatcher matcher, @NotNull java.lang.String name, @NotNull java.lang.String displayName, int minValue, int maxValue)Adds an attribute to check.voidvalidateGameObject(G gameObject, @NotNull ErrorCollector<G,A,R> errorCollector)Validates a game object.-
Methods inherited from class net.sf.gridarta.model.validation.AbstractValidator
getKey, isDefaultEnabled, isEnabled, setEnabled
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.gridarta.model.validation.Validator
getKey, isDefaultEnabled, isEnabled, setEnabled
-
-
-
-
Constructor Detail
-
AttributeRangeChecker
public AttributeRangeChecker(@NotNull @NotNull ValidatorPreferences validatorPreferences)Creates a new instance.- Parameters:
validatorPreferences- the validator preferences to use
-
-
Method Detail
-
add
public void add(int type, @NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String displayName, int minValue, int maxValue) throws InvalidCheckExceptionAdds an attribute to check. The validator generates an error if the attribute value is outside the given value range.- Parameters:
type- the object type to checkname- the attribute name to checkdisplayName- the description for error messagesminValue- the minimum expected valuemaxValue- the maximum expected value- Throws:
InvalidCheckException- if the check is invalid
-
add
public void add(@NotNull @NotNull GameObjectMatcher matcher, @NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String displayName, int minValue, int maxValue) throws InvalidCheckExceptionAdds an attribute to check. The validator generates an error if the attribute value is outside the given value range.- Parameters:
matcher- the game object matchername- the attribute name to checkdisplayName- the description for error messagesminValue- the minimum expected valuemaxValue- the maximum expected value- Throws:
InvalidCheckException- if the check is invalid
-
validateGameObject
public void validateGameObject(@NotNull G gameObject, @NotNull @NotNull ErrorCollector<G,A,R> errorCollector)Description copied from interface:GameObjectValidatorValidates a game object.- Specified by:
validateGameObjectin interfaceGameObjectValidator<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
gameObject- the game object to validateerrorCollector- the error collector to report errors to
-
-