@Override public void acceptInstance(InstanceEvent e){
  if (e.getStatus() == InstanceEvent.FORMAT_AVAILABLE) {
    m_batch=new LinkedList<Instance>();
    m_structure=e.getStructure();
    if (m_log != null) {
      m_log.logMessage("[InstanceStreamToBatch] passing on structure.");
    }
    DataSetEvent dse=new DataSetEvent(this,m_structure);
    notifyDataListeners(dse);
  }
 else   if (e.getStatus() == InstanceEvent.INSTANCE_AVAILABLE) {
    m_batch.add(e.getInstance());
  }
 else {
    if (e.getInstance() != null) {
      m_batch.add(e.getInstance());
    }
    Instances dataSet=new Instances(m_structure,m_batch.size());
    for (    Instance i : m_batch) {
      dataSet.add(i);
    }
    dataSet.compactify();
    m_batch=null;
    if (m_log != null) {
      m_log.logMessage("[InstanceStreamToBatch] sending batch to listeners.");
    }
    DataSetEvent dse=new DataSetEvent(this,dataSet);
    notifyDataListeners(dse);
  }
}

@ Override public void acceptInstance ( InstanceEvent e ) { if ( e . getStatus ( ) == InstanceEvent . FORMAT_AVAILABLE ) { m_batch = new LinkedList < Instance > ( ) ; m_structure = e . getStructure ( ) ; if ( m_log != null ) { m_log . logMessage ( "[InstanceStreamToBatch] passing on structure." ) ; } DataSetEvent dse = new DataSetEvent ( this , m_structure ) ; notifyDataListeners ( dse ) ; } else if ( e . getStatus ( ) == InstanceEvent . INSTANCE_AVAILABLE ) { m_batch . add ( e . getInstance ( ) ) ; } else { if ( e . getInstance ( ) != null ) { m_batch . add ( e . getInstance ( ) ) ; } Instances dataSet = new Instances ( m_structure , m_batch . size ( ) ) ; for ( Instance i : m_batch ) { dataSet . add ( i ) ; } dataSet . compactify ( ) ; m_batch = null ; if ( m_log != null ) { m_log . logMessage ( "[InstanceStreamToBatch] sending batch to listeners." ) ; } DataSetEvent dse = new DataSetEvent ( this , dataSet ) ; notifyDataListeners ( dse ) ; } }
accept an instance to add to the batch .
