// Sets the substance field to whatever substance is selected by the combo
 // box
 private void setSubstance() {
   String name = (String) substanceSelector.getSelectedItem();
   substance = (Substance) system.getEntity(name);
   if (metric != null) {
     metric.setSubstance(substance);
   }
   updateTarget();
 }
 /** Save most recent result to database. */
 @Override
 public void save() {
   if (result == null) {
     result = returnData() + "";
   }
   version = currentVersion;
   super.save();
 }
 public DoseObjectiveEditor(
     JFrame jf, ParameterSearchDoseResponseEditor e, TargetDoseObjective tdo) {
   this(jf, e);
   metric = tdo.getMetric();
   substance = metric.getSubstance();
   substanceSelector.setSelectedItem(substance.getName());
   objective = tdo.getObjective();
   weightField.setText((new Double(tdo.getWeight())).toString());
   updateTarget();
 }
Exemple #4
0
 @Override
 public void calibrate() {
   MemoryMXBean mxBean = ManagementFactory.getMemoryMXBean();
   long lastUsed = memoryUsed();
   for (int i = 0; i < 10; i++) {
     System.gc();
     System.runFinalization();
     long used = memoryUsed();
     if (mxBean.getObjectPendingFinalizationCount() == 0 && used >= lastUsed) {
       break;
     } else {
       lastUsed = used;
     }
   }
   super.calibrate();
 }