public int fillApps(int agentIndex, int noToBeFilled, int appIndex) { int endIndex = agentIndex + noToBeFilled; AgentStateList newAgentStateList = new AgentStateList(); AgentDataContainer newAgentDataContainer = new AgentDataContainer(); for (; agentIndex < endIndex; agentIndex++) { AgentState agentState = agentStateList.get(agentIndex); String agentID = agentState.getID(); ActionPerceptContainer actionPerceptContainer = agentDataContainer.get(agentID); newAgentStateList.add(agentState); newAgentDataContainer.put(agentID, actionPerceptContainer); } AddressAgentListTuple appsInfo = addressTable.get(appIndex); appsInfo.setAgentList(newAgentStateList); appsInfo.setAgentDataContainer(newAgentDataContainer); return agentIndex; }