/** * Input an instance for filtering. Filter requires all training instances be * read before producing output. * * @param instance the input instance * @return true if the filtered instance may now be collected with output(). * @throws IllegalStateException if no input format has been set * @throws Exception if conversion fails */ @Override public boolean input(Instance instance) throws Exception { Instance inst; if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (isNewBatch()) { resetQueue(); m_NewBatch = false; } if (isFirstBatchDone()) { inst = convertInstance(instance); inst.setDataset(getOutputFormat()); push(inst, false); // No need to copy return true; } else { bufferInput(instance); return false; } }
/** * Input an instance for filtering. Filter requires all training instances be * read before producing output. * * @param instance the input instance * @return true if the filtered instance may now be collected with output(). * @throws IllegalStateException if no input format has been set * @throws Exception if conversion fails */ @Override public boolean input(Instance instance) throws Exception { Instance inst; if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (isNewBatch()) { resetQueue(); m_NewBatch = false; } if (isFirstBatchDone()) { inst = convertInstance(instance); inst.setDataset(getOutputFormat()); push(inst, false); // No need to copy return true; } else { bufferInput(instance); return false; } }