/** * Copies string/relational values contained in the instance copied to a new dataset. The Instance * must already be assigned to a dataset. This dataset and the destination dataset must have the * same structure. * * @param instance the Instance containing the string/relational values to copy. * @param isInput if true the input format and input attribute locators are used otherwise the * output format and output locators */ protected void copyValues(Instance instance, boolean isInput) { RelationalLocator.copyRelationalValues( instance, (isInput) ? m_InputFormat : m_OutputFormat, (isInput) ? m_InputRelAtts : m_OutputRelAtts); StringLocator.copyStringValues( instance, (isInput) ? m_InputFormat : m_OutputFormat, (isInput) ? m_InputStringAtts : m_OutputStringAtts); }
/** * Takes string/relational values referenced by an Instance and copies them from a source dataset * to a destination dataset. The instance references are updated to be valid for the destination * dataset. The instance may have the structure (i.e. number and attribute position) of either * dataset (this affects where references are obtained from). Only works if the number of * string/relational attributes is the same in both indices (implicitly these string/relational * attributes should be semantically same but just with shifted positions). * * @param instance the instance containing references to strings/ relational values in the source * dataset that will have references updated to be valid for the destination dataset. * @param instSrcCompat true if the instance structure is the same as the source, or false if it * is the same as the destination (i.e. which of the string/relational attribute indices * contains the correct locations for this instance). * @param srcDataset the dataset for which the current instance string/relational value references * are valid (after any position mapping if needed) * @param destDataset the dataset for which the current instance string/relational value * references need to be inserted (after any position mapping if needed) */ protected void copyValues( Instance instance, boolean instSrcCompat, Instances srcDataset, Instances destDataset) { RelationalLocator.copyRelationalValues( instance, instSrcCompat, srcDataset, m_InputRelAtts, destDataset, m_OutputRelAtts); StringLocator.copyStringValues( instance, instSrcCompat, srcDataset, m_InputStringAtts, getOutputFormat(), m_OutputStringAtts); }