if (DBUtils.dbMode && theWholeSoc != null) return theWholeSoc; theWholeSoc = new GenericComponentData(); theWholeSoc.setType(ComponentData.SOCIETY); theWholeSoc.setName(getExperimentName()); theWholeSoc.setClassName("java.lang.Object"); theWholeSoc.setOwner(this); theWholeSoc.setParent(null);  addNodes();       List components = getComponents(); for (int i = 0; i < components.size(); i++) { BaseComponent soc = (BaseComponent) components.get(i); soc.addComponentData(theWholeSoc); }  for (int i = 0; i < components.size(); i++) { BaseComponent soc = (BaseComponent) components.get(i); soc.modifyComponentData(theWholeSoc); }
saveToDb();
  public ComponentData getSocietyComponentData() {    if (DBUtils.dbMode && theWholeSoc != null)      return theWholeSoc;    theWholeSoc = new GenericComponentData();    theWholeSoc.setType(ComponentData.SOCIETY);    theWholeSoc.setName(getExperimentName()); // this should be experiment: trial FIXME    theWholeSoc.setClassName("java.lang.Object"); // leave this out? FIXME    theWholeSoc.setOwner(this); // the experiment    theWholeSoc.setParent(null);    // For each node, create a GenericComponentData, and add it to the society    addNodes();    // Some components will want access to the complete set of Nodes in the society, etc.    // To get that, they must get back to the root soc object,    // and do a getOwner and go from there. Ugly.        // Now ask each component in turn to add its stuff    List components = getComponents();    for (int i = 0; i < components.size(); i++) {      BaseComponent soc = (BaseComponent) components.get(i);      soc.addComponentData(theWholeSoc);    }    // Then give everyone a chance to modify what they've collectively produced    for (int i = 0; i < components.size(); i++) {      BaseComponent soc = (BaseComponent) components.get(i);      soc.modifyComponentData(theWholeSoc);    }        return theWholeSoc;  }