SocietyComponent[] societyComponentsAry = new SocietyComponent[nSocieties]; for (int i = 0; i < nSocieties; i++) { SocietyComponent society = (SocietyComponent) ((DefaultMutableTreeNode) societies.getChildAt(i)).getUserObject(); societyComponentsAry[i] = society;
if (nSocieties > 1) {  System.err.println("Only 1 society in an experiment!"); } else if (nSocieties == 1) { SocietyComponent society = (SocietyComponent) ((DefaultMutableTreeNode) societies.getChildAt(0)).getUserObject();
  private void reconcileExperimentNodes() {    int nSocieties = societies.getChildCount();    SocietyComponent[] societyComponentsAry = new SocietyComponent[nSocieties];    for (int i = 0; i < nSocieties; i++) {      SocietyComponent society = (SocietyComponent) ((DefaultMutableTreeNode) societies.getChildAt(i)).getUserObject();      societyComponentsAry[i] = society;      //      society.setEditable(false); // so society editability tracks experiment editability    }    experiment.setSocietyComponents(societyComponentsAry);    int nRecipes = recipes.getChildCount();    RecipeComponent[] recipeAry = new RecipeComponent[nRecipes];    for (int i = 0; i < nRecipes; i++) {      recipeAry[i] =        (RecipeComponent) ((DefaultMutableTreeNode) recipes.getChildAt(i)).getUserObject();      //      recipeAry[i].setEditable(false);    }    experiment.setRecipes(recipeAry);    experiment.invalidateTrials(); // and force experiment to recreate trials  }