/** * Input an instance for filtering. Ordinarily the instance is processed * and made available for output immediately. Some filters require all * 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 structure has been defined */ public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } Instance inst = null; if (instance instanceof SparseInstance) { inst = new DenseInstance(instance.weight(), instance.toDoubleArray()); inst.setDataset(instance.dataset()); } else { inst = (Instance)instance.copy(); } push(inst, false); // No need to copy instance return true; }
/** * Input an instance for filtering. Ordinarily the instance is processed * and made available for output immediately. Some filters require all * 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 structure has been defined */ public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } Instance inst = null; if (instance instanceof SparseInstance) { inst = new DenseInstance(instance.weight(), instance.toDoubleArray()); inst.setDataset(instance.dataset()); } else { inst = (Instance)instance.copy(); } push(inst, false); // No need to copy instance return true; }