Пример #1
0
 @Override
 public void setChildren(final List<? extends ISymbol> children) {
   // First we verify the control architecture
   final IArchitecture control = getArchitecture();
   if (control == null) {
     throw GamaRuntimeException.error(
         "The control of species " + description.getName() + " cannot be computed");
   }
   // Then we classify the children in their categories
   for (final ISymbol s : children) {
     if (s instanceof ISpecies) {
       final ISpecies oneMicroSpecies = (ISpecies) s;
       oneMicroSpecies.setMacroSpecies(this);
       microSpecies.put(oneMicroSpecies.getName(), oneMicroSpecies);
     } else if (s instanceof IVariable) {
       variables.put(s.getName(), (IVariable) s);
     } else if (s instanceof AspectStatement) {
       aspects.put(s.getName(), (AspectStatement) s);
     } else if (s instanceof ActionStatement) {
       if (!s.getDescription().isBuiltIn()) {
         String name = s.getName();
         if (name.equals(initActionName)) {
           isInitOverriden = true;
         } else if (name.equals(stepActionName)) {
           isStepOverriden = true;
         }
       }
       actions.put(s.getName(), (ActionStatement) s);
     } else if (s instanceof UserCommandStatement) {
       userCommands.put(s.getName(), (UserCommandStatement) s);
     } else if (s instanceof IStatement) {
       behaviors.add((IStatement) s); // reflexes, states or tasks
     }
   }
   control.setChildren(behaviors);
   control.verifyBehaviors(this);
 }