private void assertAtLeastOne(final IDescription desc, final String facet) { final IDescription sd = desc.getEnclosingDescription(); if (!(sd instanceof SpeciesDescription)) { return; } for (final IDescription child : ((SpeciesDescription) sd).getBehaviors()) { String s = child.getKeyword(); if (s.equals(STATE) || s.equals(USER_PANEL)) { final IExpression expr = child.getFacets().getExpr(facet); if (expr == null) { continue; } if (IExpressionFactory.TRUE_EXPR.equals(expr)) { return; } } } final String error = "No " + facet + " state defined"; sd.error( error, IGamlIssue.MISSING_DEFINITION, sd.getUnderlyingElement(null), desc.getKeyword(), facet, TRUE); }
// To be called once the validation has been done @Override public void document(final IDescription desc) { if (desc == null) { return; } EObject e = desc.getUnderlyingElement(null); if (e == null) { return; } if (!CACHE2.containsKey(e.eResource().getURI())) { return; } setGamlDocumentation(e, desc); for (IDescription d : desc.getChildren()) { document(d); } }