addAgents(experiment, nodes, soc.getAgents(), trialId, assemblyMatch);
addAgents(experiment, nodes, allagents, trialId, assemblyMatch);
  private void createCMTExperiment(DefaultMutableTreeNode node,                                   String originalExperimentName,                                   String experimentName,                                   String experimentId,                                   String trialId,                                   boolean isCloned) {    //    System.out.println("Creating society");    // get assembly ids for trial    ArrayList assemblyIds = getTrialAssemblyIds(experimentId, trialId);    String assemblyMatch = getAssemblyMatch(assemblyIds);    // get nodes for trial    ArrayList nodes = getNodes(trialId, assemblyMatch);    ArrayList hosts = getHosts(trialId, assemblyMatch);    CMTSociety soc = null;    if (assemblyIds.size() != 0) {      soc = new CMTSociety(assemblyIds);            soc.initProperties();    } else { // We need to create a new trial.      // Need to have the experiment id, trial id, and multiplicity      // for the call that will generate the assembly here.      System.out.println("No assemblies for: " + experimentId + " " + trialId);      return; // creating an experiment from scratch not implemented yet    }    Experiment experiment = new Experiment((String)experimentName,                                            experimentId, trialId);    // The following is ugly        setDefaultNodeArguments(experiment, assemblyMatch,                            ComponentData.SOCIETY                            + "|"                            + originalExperimentName);    experiment.setCloned(isCloned);    List recipes = checkForRecipes(trialId, experimentId);    if (recipes.size() != 0) {      Iterator metIter = recipes.iterator();      while (metIter.hasNext()) {        DbRecipe dbRecipe = (DbRecipe) metIter.next();        RecipeComponent mc = createRecipeComponent(dbRecipe.name, dbRecipe.cls);        setRecipeComponentProperties(dbRecipe, mc);        experiment.addRecipe(mc);        if (!recipeNames.contains(mc.getRecipeName())) {          addRecipeToWorkspace(mc, node);        }      }    }    experiment.addSocietyComponent((SocietyComponent)soc);    // Add all Nodes.    addAgents(experiment, nodes, soc.getAgents(), trialId, assemblyMatch);    // Add all Hosts.    Iterator hostIter = hosts.iterator();    while (hostIter.hasNext()) {      String hostName = (String) hostIter.next();      HostComponent hc = experiment.addHost(hostName);      setComponentProperties((ConfigurableComponent) hc, hostName, assemblyMatch);    }    mapNodesToHosts(experiment, assemblyMatch);    workspace.setSelection(addExperimentToWorkspace(experiment, node));    // if the experiment hasn't been cloned, then save it so it's runnable    if (!isCloned)      experiment.saveToDb();  }