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 .