cdc.applic.mountability.core.MountabilityDataCheckerImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdc-applic-mountability-core Show documentation
Show all versions of cdc-applic-mountability-core Show documentation
Applicabilities Mountability Core.
The newest version!
package cdc.applic.mountability.core;
import java.util.ArrayList;
import java.util.List;
import cdc.applic.dictionaries.checks.SemanticChecker;
import cdc.applic.dictionaries.handles.DictionaryHandle;
import cdc.applic.expressions.Expression;
import cdc.applic.expressions.checks.ApplicIssue;
import cdc.applic.expressions.checks.SyntaxChecker;
import cdc.applic.mountability.MountabilityData;
import cdc.applic.mountability.MountabilityDataChecker;
import cdc.issues.IssuesHandler;
/**
* Implementation of {@link MountabilityDataChecker}.
*
* @param The Use Point type.
* @param The Variant type.
*/
public class MountabilityDataCheckerImpl implements MountabilityDataChecker {
private final DictionaryHandle handle;
public MountabilityDataCheckerImpl(DictionaryHandle handle) {
this.handle = handle;
}
@Override
public void check(MountabilityData data,
IssuesHandler handler) {
final SyntaxChecker syntyax = new SyntaxChecker();
final SemanticChecker semantic = new SemanticChecker(handle.getDictionary());
// Buffer of issues
final List issues = new ArrayList<>();
for (final U usePoint : data.getUsePoints()) {
for (final V variant : data.getVariants(usePoint)) {
final Expression applicability = data.getVariantApplicability(usePoint, variant);
issues.clear();
syntyax.check(applicability, issues);
if (issues.isEmpty()) {
semantic.check(applicability, issues);
}
handler.issues(issues);
}
}
}
}