Package org.encog.workbench.dialogs.createfile

Examples of org.encog.workbench.dialogs.createfile.CreateFileDialog


import org.encog.workbench.dialogs.trainingdata.CreateEmptyTrainingDialog;
import org.encog.workbench.util.FileUtil;

public class CreateNewFile {
  public static void performCreateFile() throws IOException {
    CreateFileDialog dialog = new CreateFileDialog(EncogWorkBench
        .getInstance().getMainWindow());
    dialog.setType(CreateFileType.MachineLearningMethod);
   
   
    if (dialog.process()) {
      String name = dialog.getFilename();
     
      if( name==null || name.length()==0 ) {
        EncogWorkBench.displayError("Data Missing", "Must specify a filename.");
        return;
      }
     
      File basePath = EncogWorkBench.getInstance().getMainWindow()
      .getTree().getPath();
     
      if (dialog.getType() == CreateFileType.MachineLearningMethod) {
       
        name = FileUtil.forceExtension(new File(name).getName(), "eg");
        File path = new File(basePath, name);
        if (FileUtil.checkOverWrite(path)) {
          CreateNeuralNetwork.process(path);
        }
      } else if (dialog.getType() == CreateFileType.TextFile) {
       
        name = FileUtil.forceExtension(new File(name).getName(), "txt");
        File path = new File(basePath, name);
        if (FileUtil.checkOverWrite(path)) {
          FileUtil.writeFileAsString(path, "");         
        }
      } else if (dialog.getType() == CreateFileType.CSVFile) {

        name = FileUtil.forceExtension(new File(name).getName(), "csv");
        File path = new File(basePath, name);
        if (FileUtil.checkOverWrite(path)) {
          FileUtil.writeFileAsString(path, "");
        }
      } else if (dialog.getType() == CreateFileType.TrainingFile) {
        name = FileUtil.forceExtension(new File(name).getName(), "egb");
        File path = new File(basePath, name);
        createNewEGB(path);
      } else if( dialog.getType() == CreateFileType.NEAT ) {
        name = FileUtil.forceExtension(new File(name).getName(), "eg");
        File path = new File(basePath, name);
        createNewPopulation(path);
      }
     
View Full Code Here

TOP

Related Classes of org.encog.workbench.dialogs.createfile.CreateFileDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.