protected void prepareData() throws Exception {
  if (m_Instances == null) {
    throw new Exception("No instances have been set");
  }
  if (m_RunColumnSet == -1) {
    m_RunColumn=m_Instances.numAttributes() - 1;
  }
 else {
    m_RunColumn=m_RunColumnSet;
  }
  if (m_ResultsetKeyColumnsRange == null) {
    throw new Exception("No result specifier columns have been set");
  }
  m_ResultsetKeyColumnsRange.setUpper(m_Instances.numAttributes() - 1);
  m_ResultsetKeyColumns=m_ResultsetKeyColumnsRange.getSelection();
  if (m_DatasetKeyColumnsRange == null) {
    throw new Exception("No dataset specifier columns have been set");
  }
  m_DatasetKeyColumnsRange.setUpper(m_Instances.numAttributes() - 1);
  m_DatasetKeyColumns=m_DatasetKeyColumnsRange.getSelection();
  m_Resultsets.clear();
  m_DatasetSpecifiers.removeAllSpecifiers();
  for (int i=0; i < m_Instances.numInstances(); i++) {
    Instance current=m_Instances.instance(i);
    if (current.isMissing(m_RunColumn)) {
      throw new Exception("Instance has missing value in run " + "column!\n" + current);
    }
    for (    int m_ResultsetKeyColumn : m_ResultsetKeyColumns) {
      if (current.isMissing(m_ResultsetKeyColumn)) {
        throw new Exception("Instance has missing value in resultset key " + "column " + (m_ResultsetKeyColumn + 1) + "!\n"+ current);
      }
    }
    for (    int m_DatasetKeyColumn : m_DatasetKeyColumns) {
      if (current.isMissing(m_DatasetKeyColumn)) {
        throw new Exception("Instance has missing value in dataset key " + "column " + (m_DatasetKeyColumn + 1) + "!\n"+ current);
      }
    }
    boolean found=false;
    for (int j=0; j < m_Resultsets.size(); j++) {
      Resultset resultset=m_Resultsets.get(j);
      if (resultset.matchesTemplate(current)) {
        resultset.add(current);
        found=true;
        break;
      }
    }
    if (!found) {
      Resultset resultset=new Resultset(current);
      m_Resultsets.add(resultset);
    }
    m_DatasetSpecifiers.add(current);
  }
  for (int j=0; j < m_Resultsets.size(); j++) {
    Resultset resultset=m_Resultsets.get(j);
    if (m_FoldColumn >= 0) {
      resultset.sort(m_FoldColumn);
    }
    resultset.sort(m_RunColumn);
  }
  m_ResultsetsValid=true;
}

protected void prepareData ( ) throws Exception { if ( m_Instances == null ) { throw new Exception ( "No instances have been set" ) ; } if ( m_RunColumnSet == - 1 ) { m_RunColumn = m_Instances . numAttributes ( ) - 1 ; } else { m_RunColumn = m_RunColumnSet ; } if ( m_ResultsetKeyColumnsRange == null ) { throw new Exception ( "No result specifier columns have been set" ) ; } m_ResultsetKeyColumnsRange . setUpper ( m_Instances . numAttributes ( ) - 1 ) ; m_ResultsetKeyColumns = m_ResultsetKeyColumnsRange . getSelection ( ) ; if ( m_DatasetKeyColumnsRange == null ) { throw new Exception ( "No dataset specifier columns have been set" ) ; } m_DatasetKeyColumnsRange . setUpper ( m_Instances . numAttributes ( ) - 1 ) ; m_DatasetKeyColumns = m_DatasetKeyColumnsRange . getSelection ( ) ; m_Resultsets . clear ( ) ; m_DatasetSpecifiers . removeAllSpecifiers ( ) ; for ( int i = 0 ; i < m_Instances . numInstances ( ) ; i ++ ) { Instance current = m_Instances . instance ( i ) ; if ( current . isMissing ( m_RunColumn ) ) { throw new Exception ( "Instance has missing value in run " + "column!\n" + current ) ; } for ( int m_ResultsetKeyColumn : m_ResultsetKeyColumns ) { if ( current . isMissing ( m_ResultsetKeyColumn ) ) { throw new Exception ( "Instance has missing value in resultset key " + "column " + ( m_ResultsetKeyColumn + 1 ) + "!\n" + current ) ; } } for ( int m_DatasetKeyColumn : m_DatasetKeyColumns ) { if ( current . isMissing ( m_DatasetKeyColumn ) ) { throw new Exception ( "Instance has missing value in dataset key " + "column " + ( m_DatasetKeyColumn + 1 ) + "!\n" + current ) ; } } boolean found = false ; for ( int j = 0 ; j < m_Resultsets . size ( ) ; j ++ ) { Resultset resultset = m_Resultsets . get ( j ) ; if ( resultset . matchesTemplate ( current ) ) { resultset . add ( current ) ; found = true ; break ; } } if ( ! found ) { Resultset resultset = new Resultset ( current ) ; m_Resultsets . add ( resultset ) ; } m_DatasetSpecifiers . add ( current ) ; } for ( int j = 0 ; j < m_Resultsets . size ( ) ; j ++ ) { Resultset resultset = m_Resultsets . get ( j ) ; if ( m_FoldColumn >= 0 ) { resultset . sort ( m_FoldColumn ) ; } resultset . sort ( m_RunColumn ) ; } m_ResultsetsValid = true ; }
separates the instances into resultsets and by dataset / run .
