if(log.isDebugEnabled()) { log.debug("Skipping Agent: " + agentsToWrite[i].getShortName()); }
  public boolean generateCompleteSociety() {    Set savedNodes = new HashSet();    Set savedAgents = new HashSet();    NodeComponent[] nodesToWrite = getNodeComponents();    AgentComponent[] agentsToWrite = getAgents();    List components = getComponents();    completeSociety = new GenericComponentData();    completeSociety.setType(ComponentData.SOCIETY);    completeSociety.setName(getExperimentName()); // this should be experiment: trial FIXME    completeSociety.setClassName("java.lang.Object"); // Must not be null    completeSociety.setOwner(this); // the experiment    completeSociety.setParent(null);    addDefaultNodeArguments(completeSociety);    // For each node, create a GenericComponentData, and add it to the society    for (Iterator i = hosts.iterator(); i.hasNext(); ) {      ExperimentHost host = (ExperimentHost) i.next();      ComponentData hc = new GenericComponentData();      if(log.isDebugEnabled()) {        log.debug("Processing Host: " + host.getShortName());      }      hc.setType(ComponentData.HOST);      hc.setName(host.getShortName());      hc.setClassName("");      hc.setOwner(this);      hc.setParent(completeSociety);      addPropertiesAsParameters(hc, host);      completeSociety.addChild(hc);      NodeComponent[] nodes = host.getNodes();      for (int j = 0; j < nodes.length; j++) {        savedAgents.addAll(generateNodeComponent(nodes[j], hc));        savedNodes.add(nodes[j]);      }    }    for (int i = 0; i < nodesToWrite.length; i++) {      if (savedNodes.contains(nodesToWrite[i])) continue;      savedAgents.addAll(generateNodeComponent(nodesToWrite[i], completeSociety));      savedNodes.add(nodesToWrite[i]);    }    for (int i = 0; i < agentsToWrite.length; i++) {      if (savedAgents.contains(agentsToWrite[i])) {        if(log.isDebugEnabled()) {          log.debug("Skipping Agent: " + agentsToWrite[i].getShortName());        }        continue;      }      if(log.isDebugEnabled()) {        log.debug("Writing Agent: " + agentsToWrite[i].getShortName());      }      generateAgentComponent(agentsToWrite[i], completeSociety, this);      savedAgents.add(agentsToWrite[i]);    }    // Now ask each component in turn to add its stuff    boolean componentWasRemoved = false;    for (int i = 0, n = components.size(); i < n; i++) {      BaseComponent soc = (BaseComponent) components.get(i);      if(log.isDebugEnabled()) {        log.debug(soc + ".addComponentData");      }      soc.addComponentData(completeSociety);      // Components can notice here if they had to remove      // a component (or, I suppose, modify)      componentWasRemoved |= soc.componentWasRemoved();      // Note that no current component returns true here    }    return componentWasRemoved;  }