/** * Signify that this batch of input to the filter is finished. If the filter * requires all instances prior to filtering, output() may now be called to * retrieve the filtered instances. Any subsequent instances filtered should * be filtered based on setting obtained from the first batch (unless the * setInputFormat has been re-assigned or new options have been set). This * implementation randomizes all the instances received in the batch. * * @return true if there are instances pending output * @throws IllegalStateException if no input format has been set. */ @Override public boolean batchFinished() { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (!isFirstBatchDone()) { getInputFormat().randomize(m_Random); } for (int i = 0; i < getInputFormat().numInstances(); i++) { push(getInputFormat().instance(i), false); // No need to copy because of bufferInput() } flushInput(); m_NewBatch = true; m_FirstBatchDone = true; return (numPendingOutput() != 0); }
/** * Signify that this batch of input to the filter is finished. If the filter * requires all instances prior to filtering, output() may now be called to * retrieve the filtered instances. Any subsequent instances filtered should * be filtered based on setting obtained from the first batch (unless the * setInputFormat has been re-assigned or new options have been set). This * implementation randomizes all the instances received in the batch. * * @return true if there are instances pending output * @throws IllegalStateException if no input format has been set. */ @Override public boolean batchFinished() { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (!isFirstBatchDone()) { getInputFormat().randomize(m_Random); } for (int i = 0; i < getInputFormat().numInstances(); i++) { push(getInputFormat().instance(i), false); // No need to copy because of bufferInput() } flushInput(); m_NewBatch = true; m_FirstBatchDone = true; return (numPendingOutput() != 0); }