List of usage examples for weka.core.converters SerializedInstancesLoader FILE_EXTENSION
String FILE_EXTENSION
To view the source code for weka.core.converters SerializedInstancesLoader FILE_EXTENSION.
Click Source Link
From source file:meka.gui.explorer.Explorer.java
License:Open Source License
/** * Adds an undo point./*from w w w. j av a2 s . c o m*/ * * @return true if successfully added */ public boolean addUndoPoint() { boolean result; File tempFile; ObjectOutputStream oos; ArrayList data; if (m_Data == null) return false; tempFile = null; try { // create temporary file tempFile = File.createTempFile("meka", SerializedInstancesLoader.FILE_EXTENSION); tempFile.deleteOnExit(); data = new ArrayList(); data.add(m_CurrentFile); data.add(m_Data); // save data oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(tempFile))); oos.writeObject(data); oos.flush(); oos.close(); m_Undo.add(tempFile); result = true; } catch (Exception e) { result = false; handleException(null, "Failed to save undo data to '" + tempFile + "':", e); JOptionPane.showMessageDialog(this, "Failed to save undo data to '" + tempFile + "':\n" + e, "Error", JOptionPane.ERROR_MESSAGE); } updateMenu(); return result; }
From source file:sirius.trainer.step3.SelectFeaturePane.java
License:Open Source License
/** * Backs up the current state of the dataset, so the changes can be undone. * //from w w w.j av a 2 s . c o m * @throws Exception if an error occurs */ public void addUndoPoint() throws Exception { if (applicationData.getDataset1Instances() != null) { //create temporary file File tempFile = File.createTempFile("weka", SerializedInstancesLoader.FILE_EXTENSION); tempFile.deleteOnExit(); ObjectOutputStream oos = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(tempFile))); oos.writeObject(applicationData.getDataset1Instances()); oos.flush(); oos.close(); //update undo file list if (m_tempUndoFiles[m_tempUndoIndex] != null)//remove undo points that are too old m_tempUndoFiles[m_tempUndoIndex].delete(); m_tempUndoFiles[m_tempUndoIndex] = tempFile; if (++m_tempUndoIndex >= m_tempUndoFiles.length)//wrap pointer around m_tempUndoIndex = 0; undoButton.setEnabled(true); } }