private static void createAgentsInCatalog(AObjectCatalog agents, AgentType atype, Class<?> aclass,
      int num) {
    int added = 0;
    try {
      for (int i = 0; i < num; i++) {
        // Create a new instance (name prefix 'a' for agents)
        Agent agent =
            (Agent) (aclass.getConstructor(String.class).newInstance("a" + Integer.toString(i)));
        // Assign the static goal plan tree hierarchy to this instance
        agent.setGoals(atype.getGoals());
        // Add this instance to the catalog of agent instances
        agents.push(agent);
        added++;
      }
      logger.info("Finished loading {} agents", added);

    } catch (NoSuchMethodException | SecurityException | InstantiationException
        | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
      logger.error("Could not create instance of class " + aclass.getName());
    }

  }
private static void createAgentsInCatalog(AObjectCatalog agents, AgentType atype, Class<?> aclass,
      int num) {
    int added = 0;
    try {
      for (int i = 0; i < num; i++) {
        
        Agent agent =
            (Agent) (aclass.getConstructor(String.class).newInstance("a" + Integer.toString(i)));
        
        agent.setGoals(atype.getGoals());
        
        agents.push(agent);
        added++;
      }
      logger.info("Finished loading {} agents", added);

    } catch (NoSuchMethodException | SecurityException | InstantiationException
        | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
      logger.error("Could not create instance of class " + aclass.getName());
    }

  }
private static void createAgentsInCatalog ( AObjectCatalog agents , AgentType atype , Class < ? > aclass , int num ) { int added = 0 ; try { for ( int i = 0 ; i < num ; i ++ ) { // Create a new instance (name prefix 'a' for agents) Agent agent = ( Agent ) ( aclass . getConstructor ( String . class ) . newInstance ( "a" + Integer . toString ( i ) ) ) ; // Assign the static goal plan tree hierarchy to this instance agent . setGoals ( atype . getGoals ( ) ) ; // Add this instance to the catalog of agent instances agents . push ( agent ) ; added ++ ; } logger . info ( "Finished loading {} agents" , added ) ; } catch ( NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { logger . error ( "Could not create instance of class " + aclass . getName ( ) ) ; } }
Creates the specified number of agent instances of the given type and adds them to the catalog.

@param agents the catalog to add agents to
@param atype the type of agents to create
@param aclass the class of that agent type
@param num the number of instances of that agent (class) to create
Creates the specified number of agent instances of the given type and adds them to the catalog .