push(new SparseInstance(instance.weight(), newVals, newIndices, instance.numAttributes()));
inst = new SparseInstance(instance.weight(), vals, indices, instance.numAttributes());
  private void convertInstance(Instance instance) throws Exception {      if (!(instance instanceof SparseInstance)) {      double[] newVals = new double[getInputFormat().numAttributes()];      for(int j = 0; j < instance.numAttributes(); j++) {	if (instance.isMissing(j) &&	    (getInputFormat().attribute(j).isNominal() ||	     getInputFormat().attribute(j).isNumeric())) {	  newVals[j] = m_ModesAndMeans[j]; 	} else {	  newVals[j] = instance.value(j);	}      }       push(new Instance(instance.weight(), newVals));    } else {      double[] newVals = new double[instance.numValues()];      int[] newIndices = new int[instance.numValues()];      int num = 0;      for(int j = 0; j < instance.numValues(); j++) {	if (instance.isMissingSparse(j) &&	    (instance.attributeSparse(j).isNominal() ||	     instance.attributeSparse(j).isNumeric())) {	  if (m_ModesAndMeans[instance.index(j)] != 0.0) {	    newVals[num] = m_ModesAndMeans[instance.index(j)];	    newIndices[num] = instance.index(j);	    num++;	  } 	} else {	  newVals[num] = instance.valueSparse(j);	  newIndices[num] = instance.index(j);	  num++;	}      }       if (num == instance.numValues()) {	push(new SparseInstance(instance.weight(), newVals, newIndices,			      instance.numAttributes()));      } else {	double[] tempVals = new double[num];	int[] tempInd = new int[num];	System.arraycopy(newVals, 0, tempVals, 0, num);	System.arraycopy(newIndices, 0, tempInd, 0, num);	push(new SparseInstance(instance.weight(), tempVals, tempInd,				instance.numAttributes()));      }    }  }