Package ca.nengo.io

Examples of ca.nengo.io.FileManager


   *            File to be saved in
   * @throws IOException
   *             if model cannot be saved to file
   */
  public void saveModel(File file) throws IOException {
    FileManager fm = new FileManager();

    fm.save(this.getModel(), file);
    new TransientStatusMessage(this.getFullName() + " was saved to " + file.toString(), 2500);
  }
View Full Code Here


    fm.save(this.getModel(), file);
    new TransientStatusMessage(this.getFullName() + " was saved to " + file.toString(), 2500);
  }
 
  public void generateScript(File file) throws IOException {
    FileManager fm = new FileManager();

    fm.generate(this.getModel(), file.toString());
    new TransientStatusMessage(this.getFullName() + " generated script " + file.toString(), 2500);
  }
View Full Code Here

    NEFEnsemble result = null;

        if( storageName.length() > 0 ){
            File ensembleFile = new File(myDatabase, storageName + "." + FileManager.ENSEMBLE_EXTENSION);

            FileManager fm = new FileManager();

            if (!overwrite && ensembleFile.exists() && ensembleFile.canRead()) {
                try {
                    result = (NEFEnsemble) fm.load(ensembleFile);

                    result.setName(name);
                    if(result.getNodes().length != n) {
                        ourLogger.warn("Number of nodes in ensemble loaded from file does not match requested number of nodes");
                    }
                    if(result.getDimension() != dim) {
                        ourLogger.warn("Dimension of ensemble loaded from file does not match requested dimension");
                    }
                } catch (Exception e) {
                    ourLogger.error("Failed to load file " + ensembleFile.getAbsolutePath() + ". New ensemble will be created.", e);
                }
            }
            if (result == null) {
                result = doMake(name, n, radii, 0);

                try {
                    // Set the ensemble's factory to null to allow saving with customized ensemble factories
                    result.setEnsembleFactory(null);
                    fm.save(result, ensembleFile);
                } catch (IOException e) {
                    ourLogger.error("Failed to save file " + ensembleFile.getAbsolutePath(), e);
                }
            }
    }
View Full Code Here

TOP

Related Classes of ca.nengo.io.FileManager

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.