/// <summary> Sets the format of the input instances. If the filter is able to /// determine the output format before seeing any input instances, it /// does so here. This default implementation clears the output format /// and output queue, and the new batch flag is set. Overriders should /// call <code>super.setInputFormat(Instances)</code> /// /// </summary> /// <param name="instanceInfo">an Instances object containing the input instance /// structure (any instances contained in the object are ignored - only the /// structure is required). /// </param> /// <returns> true if the outputFormat may be collected immediately /// </returns> /// <exception cref="Exception">if the inputFormat can't be set successfully /// </exception> public virtual bool setInputFormat(Instances instanceInfo) { m_InputFormat = instanceInfo.stringFreeStructure(); m_InputStringAtts = getStringIndices(instanceInfo); m_OutputFormat = null; m_OutputQueue = new Queue(); m_NewBatch = true; m_FirstBatchDone = false; return false; }
/// <summary> Sets the format of output instances. The derived class should use this /// method once it has determined the outputformat. The /// output queue is cleared. /// /// </summary> /// <param name="outputFormat">the new output format /// </param> protected internal virtual void setOutputFormat(Instances outputFormat) { if (outputFormat != null) { m_OutputFormat = outputFormat.stringFreeStructure(); m_OutputStringAtts = getStringIndices(m_OutputFormat); // Rename the attribute System.String relationName = outputFormat.relationName() + "-" + this.GetType().FullName; // if (this instanceof OptionHandler) // { // String [] options = ((OptionHandler)this).getOptions(); // for (int i = 0; i < options.length; i++) // { // relationName += options[i].trim(); // } // } m_OutputFormat.RelationName = relationName; } else { m_OutputFormat = null; } m_OutputQueue = new Queue(); }