Commit a547878e authored by Riegel's avatar Riegel
Browse files

Refactor: Add Validator flag to Check

Checkable now checks if an accepted Visitor is flagged as a Validator
before setting the object as validated=true. Allows the implementation
of Visitors for the Check-Engine that serve as utilities, e.g. to enable
decoupled collection of all contained Geometries in a CityObject.
parent 3dac795e
...@@ -53,6 +53,7 @@ public abstract class Check { ...@@ -53,6 +53,7 @@ public abstract class Check {
private final List<Class<Checkable>> applicableToClasses = new ArrayList<>(2); private final List<Class<Checkable>> applicableToClasses = new ArrayList<>(2);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected Check() { protected Check() {
Method[] declaredMethods = getClass().getDeclaredMethods(); Method[] declaredMethods = getClass().getDeclaredMethods();
...@@ -102,6 +103,15 @@ public abstract class Check { ...@@ -102,6 +103,15 @@ public abstract class Check {
*/ */
public abstract RequirementType getType(); public abstract RequirementType getType();
/**
* Returns whether this check validates a feature.
*
* @return true if it validates, false otherwise
*/
public boolean isValidator() {
return true;
}
/** /**
* Checks whether the check can be executed on this checkable, meaning the * Checks whether the check can be executed on this checkable, meaning the
* checkable or its content can not have any error of any check dependent on * checkable or its content can not have any error of any check dependent on
......
...@@ -71,7 +71,9 @@ public abstract class Checkable implements Serializable { ...@@ -71,7 +71,9 @@ public abstract class Checkable implements Serializable {
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
} }
setValidated(true); if (c.isValidator()) {
setValidated(true);
}
} }
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment