jill/src/main/java/io/github/agentsoz/jill/core/ProgramLoader.java
public static boolean loadAgent(String className, int num, AObjectCatalog agents) {

    // Load the Agent class
    Class<?> aclass = loadClass(className, Agent.class);
    if (aclass == null) {
      return false;
    }

    // Save this agent type to the catalog of known agent types
    AgentType atype = new AgentType(className);
    atype.setAgentClass(aclass);
    GlobalState.agentTypes.push(atype);

    // Find the goals that this agent has
    String[] goals = getGoalsFromAgentInfoAnnotation(aclass);
    if (goals.length == 0) {
      return false;
    }

    // First pass: get the goals and their plans (flat goal-plan list)
    loadGoalPlanNodes(atype, goals);

    // Second pass: complete the goal-plan hierarchy
    completeGoalPlanHierarchy();

    // Now create the specified number of instances of this agent type
    createAgentsInCatalog(agents, atype, aclass, num);

    // return success
    return true;
  }
public static boolean loadAgent(String className, int num, AObjectCatalog agents) {

    // Load the Agent class
    Class<?> aclass = loadClass(className, Agent.class);
    if (aclass == null) {
      return false;
    }

    // Save this agent type to the catalog of known agent types
    AgentType atype = new AgentType(className);
    atype.setAgentClass(aclass);
    GlobalState.agentTypes.push(atype);

    // Find the goals that this agent has
    String[] goals = getGoalsFromAgentInfoAnnotation(aclass);
    if (goals.length == 0) {
      return false;
    }

    // First pass: get the goals and their plans (flat goal-plan list)
    loadGoalPlanNodes(atype, goals);

    // Second pass: complete the goal-plan hierarchy
    completeGoalPlanHierarchy();

    // Now create the specified number of instances of this agent type
    createAgentsInCatalog(agents, atype, aclass, num);

    // return success
    return true;
  }
public static boolean loadAgent ( String className , int num , AObjectCatalog agents ) { // Load the Agent class Class < ? > aclass = loadClass ( className , Agent . class ) ; if ( aclass == null ) { return false ; } // Save this agent type to the catalog of known agent types AgentType atype = new AgentType ( className ) ; atype . setAgentClass ( aclass ) ; GlobalState . agentTypes . push ( atype ) ; // Find the goals that this agent has String [ ] goals = getGoalsFromAgentInfoAnnotation ( aclass ) ; if ( goals . length == 0 ) { return false ; } // First pass: get the goals and their plans (flat goal-plan list) loadGoalPlanNodes ( atype , goals ) ; // Second pass: complete the goal-plan hierarchy completeGoalPlanHierarchy ( ) ; // Now create the specified number of instances of this agent type createAgentsInCatalog ( agents , atype , aclass , num ) ; // return success return true ; }
Creates a given number of agents of a given Class, and adds the newly created agents to the
given store.

@param className the fully qualified Java classname for the agents begin created
@param num the number of agents (class instances) to create
@param agents the store to which these agents should be added
@return true if agents were successfully created and added, false otherwise
Creates a given number of agents of a given Class and adds the newly created agents to the given store .