protected Instances determineOutputFormat(Instances inputFormat) throws Exception {
  int i;
  int[] indices;
  StringBuilder order;
  Instances output;
  m_AttributeIndices.setUpper(inputFormat.numAttributes() - 1);
  order=new StringBuilder();
  indices=m_AttributeIndices.getSelection();
  if (indices.length == 0)   throw new WekaException("No attributes defined as class attributes!");
  for (i=0; i < indices.length; i++) {
    if (i > 0)     order.append(",");
    order.append("" + (indices[i] + 1));
  }
  for (i=0; i < inputFormat.numAttributes(); i++) {
    if (m_AttributeIndices.isInRange(i))     continue;
    order.append(",");
    order.append("" + (i + 1));
  }
  m_Reorder.setAttributeIndices(order.toString());
  m_Reorder.setInputFormat(inputFormat);
  output=m_Reorder.getOutputFormat();
  output.setClassIndex(indices.length);
  output.setRelationName("-C " + indices.length);
  return output;
}

protected Instances determineOutputFormat ( Instances inputFormat ) throws Exception { int i ; int [ ] indices ; StringBuilder order ; Instances output ; m_AttributeIndices . setUpper ( inputFormat . numAttributes ( ) - 1 ) ; order = new StringBuilder ( ) ; indices = m_AttributeIndices . getSelection ( ) ; if ( indices . length == 0 ) throw new WekaException ( "No attributes defined as class attributes!" ) ; for ( i = 0 ; i < indices . length ; i ++ ) { if ( i > 0 ) order . append ( "," ) ; order . append ( "" + ( indices [ i ] + 1 ) ) ; } for ( i = 0 ; i < inputFormat . numAttributes ( ) ; i ++ ) { if ( m_AttributeIndices . isInRange ( i ) ) continue ; order . append ( "," ) ; order . append ( "" + ( i + 1 ) ) ; } m_Reorder . setAttributeIndices ( order . toString ( ) ) ; m_Reorder . setInputFormat ( inputFormat ) ; output = m_Reorder . getOutputFormat ( ) ; output . setClassIndex ( indices . length ) ; output . setRelationName ( "-C " + indices . length ) ; return output ; }
determines the output format based on the input format and returns this . in case the output format cannot be returned immediately , i . e . , hasimmediateoutputformat ( ) returns false , then this method will called from batchfinished ( ) after the call of preprocess ( instances ) , in which , e . g . , statistics for the actual processing step can be gathered .
