Trial trial = experiment.getTrials()[currentTrial];
Trial[] trials = experiment.getTrials(); Trial trial = null; if (currentTrial < trials.length) { trial = trials[currentTrial]; } else { if (log.isWarnEnabled()) log.warn("Bug 2071 in setTrialValues. currTrial = " + currentTrial + ", trials.length=" + trials.length); trial = trials[0]; currentTrial--; }
  private void setTrialValues() {    if (currentTrial >= 0)      unsetTrialValues(); // unset previous trial values    currentTrial++;  // starts with 0    Trial trial = experiment.getTrials()[currentTrial];    trialNameLabel.setText(trial.getShortName());    trialProgressBar.setValue(currentTrial+1);    Property[] properties = trial.getParameters();    Object[] values = trial.getValues();    if (log.isDebugEnabled()) {      log.debug("setTrialValues about to loop through trial properties to set");    }    for (int i = 0; i < properties.length; i++) {      if (properties[i].getValue() == null || ! properties[i].getValue().equals(values[i]))	properties[i].setValue(values[i]);    }  }