private void gatherCompositionConstraint(PatternCompositionConstraint constraint, PatternModelAcceptor<?> acceptor)
throws SpecificationBuilderException {
PatternCall call = constraint.getCall();
Pattern patternRef = call.getPatternRef();
List<String> variableNames = getVariableNames(call.getParameters(), acceptor);
if (!call.isTransitive()) {
if (constraint.isNegative())
acceptor.acceptNegativePatternCall(variableNames, patternRef);
else
acceptor.acceptPositivePatternCall(variableNames, patternRef);
} else {
if (call.getParameters().size() != 2)
throw new SpecificationBuilderException(
"Transitive closure of {1} in pattern {2} is unsupported because called pattern is not binary.",
new String[] { CorePatternLanguageHelper.getFullyQualifiedName(patternRef), patternFQN },
"Transitive closure only supported for binary patterns.", pattern);
else if (constraint.isNegative())
throw new SpecificationBuilderException("Unsupported negated transitive closure of {1} in pattern {2}",
new String[] { CorePatternLanguageHelper.getFullyQualifiedName(patternRef), patternFQN },
"Unsupported negated transitive closure", pattern);
else
acceptor.acceptBinaryTransitiveClosure(variableNames, patternRef);
}
}