if (e.isStructureOnly()) {     BatchClassifierEvent ce = new BatchClassifierEvent(this, m_Classifier, new DataSetEvent(this, e.getTrainingSet()), e.getSetNumber(), e.getMaxSetNumber());  notifyBatchClassifierListeners(ce); return; }
  public void acceptTrainingSet(final TrainingSetEvent e) {    if (m_buildThread == null) {      try {	if (m_state == IDLE) {	  synchronized (this) {	    m_state = BUILDING_MODEL;	  }	  m_trainingSet = e.getTrainingSet();	  final String oldText = m_visual.getText();	  m_buildThread = new Thread() {	      public void run() {		try {		  if (m_trainingSet != null) {		    if (m_trainingSet.classIndex() < 0) {		      // assume last column is the class		      m_trainingSet.setClassIndex(m_trainingSet.numAttributes()-1);		      if (m_log != null) {			m_log.logMessage("Classifier : assuming last "					 +"column is the class");		      }		    }		    m_visual.setAnimated();		    m_visual.setText("Building model...");		    if (m_log != null) {		      m_log.statusMessage("Classifier : building model...");		    }		    buildClassifier();		    if (m_Classifier instanceof weka.core.Drawable && 			m_graphListeners.size() > 0) {		      String grphString = 			((weka.core.Drawable)m_Classifier).graph();		      String grphTitle = m_Classifier.getClass().getName();		      grphTitle = grphTitle.substring(grphTitle.						      lastIndexOf('.')+1, 						      grphTitle.length());		      grphTitle = "Set " + e.getSetNumber() + " ("			+e.getTrainingSet().relationName() + ") "			+grphTitle;		      		      GraphEvent ge = new GraphEvent(Classifier.this, 						     grphString, 						     grphTitle);		      notifyGraphListeners(ge);		    }		    if (m_textListeners.size() > 0) {		      String modelString = m_Classifier.toString();		      String titleString = m_Classifier.getClass().getName();		      titleString = titleString.			substring(titleString.lastIndexOf('.') + 1,				  titleString.length());		      titleString = "Set "+e.getSetNumber() + " ("			+ m_trainingSet.relationName() + ") " + titleString			+ " model";		      TextEvent nt = new TextEvent(Classifier.this,						   modelString,						   titleString);		      notifyTextListeners(nt);		    }		  }		} catch (Exception ex) {		  ex.printStackTrace();		} finally {		  m_visual.setText(oldText);		  m_visual.setStatic();		  m_state = IDLE;		  if (isInterrupted()) {		    // prevent any classifier events from being fired		    m_trainingSet = null;		    if (m_log != null) {		      m_log.logMessage("Build classifier interrupted!");		      m_log.statusMessage("OK");		    }		  } else {		    // save header		    m_trainingSet = new Instances(m_trainingSet, 0);		  }		  if (m_log != null) {		    m_log.statusMessage("OK");		  }		  block(false);		}	      }		    };	  m_buildThread.setPriority(Thread.MIN_PRIORITY);	  m_buildThread.start();	  // make sure the thread is still running before we block	  //	  if (m_buildThread.isAlive()) {	  block(true);	    //	  }	  m_buildThread = null;	  m_state = IDLE;	}      } catch (Exception ex) {	ex.printStackTrace();      }    }  }