fun input(instance: Instance): Boolean { checkNotNull(getInputFormat()) { "No input instance format defined" } if (m_NewBatch) { resetQueue() m_NewBatch = false } val vals = DoubleArray(instance.numAttributes() + 1) for (i in 0 until instance.numAttributes()) { if (instance.isMissing(i)) { vals[i] = Utils.missingValue() } else { vals[i] = instance.value(i) } } m_attributeExpression.evaluateExpression(vals) var inst: Instance? = null if (instance is SparseInstance) { inst = SparseInstance(instance.weight(), vals) } else { inst = DenseInstance(instance.weight(), vals) } inst.setDataset(getOutputFormat()) copyValues(inst, false, instance.dataset(), getOutputFormat()) inst.setDataset(getOutputFormat()) push(inst) 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 .