if ( !(    (expFile.getName().toLowerCase().endsWith(Experiment.FILE_EXTENSION)) || (KOML.isPresent() && expFile.getName().toLowerCase().endsWith(KOML.FILE_EXTENSION)) || (expFile.getName().toLowerCase().endsWith(".xml")) ) ) { expFile = new File(expFile.getParent(), expFile.getName() + Experiment.FILE_EXTENSION);
if (m_FileChooser.getFileFilter() == m_ExpFilter) { if (!expFile.getName().toLowerCase().endsWith(Experiment.FILE_EXTENSION)) expFile = new File(expFile.getParent(), expFile.getName() + Experiment.FILE_EXTENSION);
  private void saveExperiment() {    int returnVal = m_FileChooser.showSaveDialog(this);    if (returnVal != JFileChooser.APPROVE_OPTION) {      return;    }    File expFile = m_FileChooser.getSelectedFile();    if ( !(    (expFile.getName().toLowerCase().endsWith(Experiment.FILE_EXTENSION))          || (KOML.isPresent() && expFile.getName().toLowerCase().endsWith(KOML.FILE_EXTENSION))          || (expFile.getName().toLowerCase().endsWith(".xml")) ) )    {       expFile = new File(expFile.getParent(), expFile.getName()                          + Experiment.FILE_EXTENSION);    }    try {      // KOML?      if ( (KOML.isPresent()) && (expFile.getAbsolutePath().toLowerCase().endsWith(KOML.FILE_EXTENSION)) ) {         KOML.write(expFile.getAbsolutePath(), m_Exp);      }      else      // XML?      if (expFile.getAbsolutePath().toLowerCase().endsWith(".xml")) {         XMLExperiment xml = new XMLExperiment();          xml.write(expFile, m_Exp);      }      // binary      else {         FileOutputStream fo = new FileOutputStream(expFile);         ObjectOutputStream oo = new ObjectOutputStream(                                 new BufferedOutputStream(fo));         oo.writeObject(m_Exp);         oo.close();      }      System.err.println("Saved experiment:\n" + m_Exp);    } catch (Exception ex) {      ex.printStackTrace();      JOptionPane.showMessageDialog(this, "Couldn't save experiment file:\n"				    + expFile				    + "\nReason:\n" + ex.getMessage(),				    "Save Experiment",				    JOptionPane.ERROR_MESSAGE);    }  }