for (int i = 0; i < nSocieties; i++) { SocietyComponent society = experiment.getSocietyComponent(i); if (!society.isSelfTerminating()) { isSelfTerminating = false; break; }
SocietyComponent society = experiment.getSocietyComponent(); if (society != null && !society.isSelfTerminating()) { isSelfTerminating = false;
  private void stopButton_actionPerformed(ActionEvent e) {    stopButton.setSelected(true); // indicate stopping    stopButton.setEnabled(false); // disable until experiment stops    int nSocieties = experiment.getSocietyComponentCount();    boolean isSelfTerminating = true;    for (int i = 0; i < nSocieties; i++) {      SocietyComponent society = experiment.getSocietyComponent(i);      if (!society.isSelfTerminating()) {	isSelfTerminating = false;	break;      }    }    // societies in experiment will self terminate    if (isSelfTerminating) {      userStoppedTrials = true;      return;    }    // need to manually stop some societies    // if societies are being monitored, ask user to confirm stop    if (experiment.isMonitored()) {      int response = 	JOptionPane.showConfirmDialog(this,				      "Experiment is being monitored; stop anyway (society monitor displays will be destroyed)?",				      "Confirm Stop",				      JOptionPane.YES_NO_OPTION);      if (response == JOptionPane.YES_OPTION) 	stopAllNodes();    } else      stopAllNodes();  }