コード例 #1
0
 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);
 }
コード例 #2
0
 private void assertNoOther(final IDescription desc, final String facet) {
   final IDescription sd = desc.getEnclosingDescription();
   if (!(sd instanceof SpeciesDescription)) {
     return;
   }
   for (final IDescription child : ((SpeciesDescription) sd).getBehaviors()) {
     if (child.equals(desc) || !child.getKeyword().equals(STATE)) {
       continue;
     }
     IExpression expr = child.getFacets().getExpr(facet);
     if (IExpressionFactory.TRUE_EXPR.equals(expr)) {
       final String error = "Only one " + facet + " state is allowed.";
       child.error(error, IGamlIssue.DUPLICATE_DEFINITION, facet, TRUE);
     }
   }
 }