Example usage for weka.core.converters AbstractFileLoader retrieveFile

List of usage examples for weka.core.converters AbstractFileLoader retrieveFile

Introduction

In this page you can find the example usage for weka.core.converters AbstractFileLoader retrieveFile.

Prototype

@Override
public File retrieveFile() 

Source Link

Document

get the File specified as the source

Usage

From source file:sirius.trainer.step3.SelectFeaturePane.java

License:Open Source License

/**
 * Loads results from a set of instances retrieved with the supplied loader. 
 * This is started in the IO thread, and a dialog is popped up
 * if there's a problem.// w  w w  . ja va2s .c  om
 *
 * @param loader   the loader to use
 */
public void setInstancesFromFile(final AbstractFileLoader loader) {
    if (applicationData.getOneThread() == null) {
        applicationData.setOneThread(new Thread() {
            public void run() {
                try {
                    Instances inst = loader.getDataSet();
                    setDataset1Instances(inst);
                } catch (Exception ex) {
                    if (JOptionPane.showOptionDialog(parent,
                            "File '" + loader.retrieveFile() + "' not recognised as an '"
                                    + loader.getFileDescription() + "' file.\n" + "Reason:\n" + ex.getMessage(),
                            "Load Instances", 0, JOptionPane.ERROR_MESSAGE, null,
                            new String[] { "OK", "Use Converter" }, null) == 1) {
                        converterQuery(loader.retrieveFile());
                    }
                    ex.printStackTrace();
                }
                applicationData.setOneThread(null);
            }
        });
        applicationData.getOneThread().setPriority(Thread.MIN_PRIORITY); // UI has most priority
        applicationData.getOneThread().start();
    } else {
        JOptionPane.showMessageDialog(this, "Can't load at this time,\n" + "currently busy with other IO",
                "Load Instances", JOptionPane.WARNING_MESSAGE);
    }
}