/// <summary> Convert a single instance over. The converted instance is 
		/// added to the end of the output queue.
		/// 
		/// </summary>
		/// <param name="instance">the instance to convert
		/// </param>
		private void  convertInstance(Instance instance)
		{
			
			Instance inst = null;
			if (instance is SparseInstance)
			{
				double[] vals = new double[instance.numValues()];
				int[] indices = new int[instance.numValues()];
				int num = 0;
				for (int j = 0; j < instance.numValues(); j++)
				{
					if (instance.isMissingSparse(j) && (getInputFormat().classIndex() != instance.index(j)) && (instance.attributeSparse(j).Nominal || instance.attributeSparse(j).Numeric))
					{
						if (m_ModesAndMeans[instance.index(j)] != 0.0)
						{
							vals[num] = m_ModesAndMeans[instance.index(j)];
							indices[num] = instance.index(j);
							num++;
						}
					}
					else
					{
						vals[num] = instance.valueSparse(j);
						indices[num] = instance.index(j);
						num++;
					}
				}
				if (num == instance.numValues())
				{
					inst = new SparseInstance(instance.weight(), vals, indices, instance.numAttributes());
				}
				else
				{
					double[] tempVals = new double[num];
					int[] tempInd = new int[num];
					Array.Copy(vals, 0, tempVals, 0, num);
					Array.Copy(indices, 0, tempInd, 0, num);
					inst = new SparseInstance(instance.weight(), tempVals, tempInd, instance.numAttributes());
				}
			}
			else
			{
				double[] vals = new double[getInputFormat().numAttributes()];
				for (int j = 0; j < instance.numAttributes(); j++)
				{
					if (instance.isMissing(j) && (getInputFormat().classIndex() != j) && (getInputFormat().attribute(j).Nominal || getInputFormat().attribute(j).Numeric))
					{
						vals[j] = m_ModesAndMeans[j];
					}
					else
					{
						vals[j] = instance.value_Renamed(j);
					}
				}
				inst = new Instance(instance.weight(), vals);
			}
			inst.Dataset = instance.dataset();
			push(inst);
		}