/** * Accept a test set * * @param e a <code>TestSetEvent</code> value */ public void acceptTestSet(final TestSetEvent e) { if (e.isStructureOnly()) notifyTestListeners(e); if (m_trainingSet != null && m_trainingSet.equalHeaders(e.getTestSet()) && m_filterThread == null) { try { if (m_state == IDLE) { m_state = FILTERING_TEST; } m_testingSet = e.getTestSet(); // final String oldText = m_visual.getText(); m_filterThread = new Thread() { public void run() { try { if (m_testingSet != null) { m_visual.setAnimated(); // m_visual.setText("Filtering test data..."); if (m_log != null) { m_log.statusMessage( statusMessagePrefix() + Messages.getInstance() .getString("Filter_AcceptTestSet_StatusMessage_Text_First") + m_testingSet.relationName() + Messages.getInstance() .getString("Filter_AcceptTestSet_StatusMessage_Text_Second")); } Instances filteredTest = features.filters.Filter.useFilter(m_testingSet, m_Filter); // m_visual.setText(oldText); m_visual.setStatic(); TestSetEvent ne = new TestSetEvent(features.gui.beans.Filter.this, filteredTest); ne.m_setNumber = e.m_setNumber; ne.m_maxSetNumber = e.m_maxSetNumber; notifyTestListeners(ne); } } catch (Exception ex) { ex.printStackTrace(); if (m_log != null) { m_log.logMessage( Messages.getInstance() .getString("Filter_AcceptTestSet_LogMessage_Text_First") + statusMessagePrefix() + ex.getMessage()); m_log.statusMessage( statusMessagePrefix() + Messages.getInstance() .getString("Filter_AcceptTestSet_StatusMessage_Text_Third")); } Filter.this.stop(); } finally { // m_visual.setText(oldText); m_visual.setStatic(); m_state = IDLE; if (isInterrupted()) { m_trainingSet = null; if (m_log != null) { m_log.logMessage( Messages.getInstance() .getString("Filter_AcceptTestSet_LogMessage_Text_Second") + statusMessagePrefix() + Messages.getInstance() .getString("Filter_AcceptTestSet_LogMessage_Text_Third")); m_log.statusMessage( statusMessagePrefix() + Messages.getInstance() .getString("Filter_AcceptTestSet_StatusMessage_Text_Fourth")); // m_log.statusMessage("OK"); } } else { if (m_log != null) { m_log.statusMessage( statusMessagePrefix() + Messages.getInstance() .getString("Filter_AcceptTestSet_StatusMessage_Text_Fifth")); } } block(false); } } }; m_filterThread.setPriority(Thread.MIN_PRIORITY); m_filterThread.start(); block(true); m_filterThread = null; m_state = IDLE; } catch (Exception ex) { ex.printStackTrace(); } } }