/** * Convert a single instance over. The converted instance is added to the end * of the output queue. * * @param instance the instance to convert */ protected void convertInstance(Instance instance) { Instance inst; m_Counter++; // build instance try { inst = (Instance) instance.copy(); // First copy string values from input to output copyValues(inst, true, inst.dataset(), outputFormatPeek()); // Insert the new attribute and reassign to output inst.setDataset(null); inst.insertAttributeAt(m_Index.getIndex()); inst.setValue(m_Index.getIndex(), m_Counter); push(inst); // No need to copy instance } catch (Exception e) { e.printStackTrace(); } }
/** * Convert a single instance over. The converted instance is added to the end * of the output queue. * * @param instance the instance to convert */ protected void convertInstance(Instance instance) { Instance inst; m_Counter++; // build instance try { inst = (Instance) instance.copy(); // First copy string values from input to output copyValues(inst, true, inst.dataset(), outputFormatPeek()); // Insert the new attribute and reassign to output inst.setDataset(null); inst.insertAttributeAt(m_Index.getIndex()); inst.setValue(m_Index.getIndex(), m_Counter); push(inst); // No need to copy instance } catch (Exception e) { e.printStackTrace(); } }