relationName = (m_sourceFile.getName()).replaceAll(
"\\.[cC][sS][vV]$", "");
} else {
relationName = "stream";
}
Instances dataSet = new Instances(relationName, atts,
m_cumulativeInstances.size());
for (int i = 0; i < m_cumulativeInstances.size(); i++) {
current = ((FastVector) m_cumulativeInstances.elementAt(i));
double[] vals = new double[dataSet.numAttributes()];
for (int j = 0; j < current.size(); j++) {
Object cval = current.elementAt(j);
if (cval instanceof String) {
if (((String) cval).compareTo("'?'") == 0) {
vals[j] = Instance.missingValue();
} else {
if (!dataSet.attribute(j).isNominal()) {
System.err.println("Wrong attribute type!!!");
System.exit(1);
}
// find correct index
Hashtable lookup = (Hashtable) m_cumulativeStructure.elementAt(
j);
int index = ((Integer) lookup.get(cval)).intValue();
vals[j] = index;
}
} else if (dataSet.attribute(j).isNominal()) {
// find correct index
Hashtable lookup = (Hashtable) m_cumulativeStructure.elementAt(
j);
int index = ((Integer) lookup.get(cval)).intValue();
vals[j] = index;
} else {
vals[j] = ((Double) cval).doubleValue();
}
}
dataSet.add(new Instance(1.0, vals));
}
m_structure = new Instances(dataSet, 0);
setRetrieval(BATCH);
m_cumulativeStructure = null; // conserve memory
return dataSet;
}