if (m_RP != rp) {
throw new Error("Unrecognized ResultProducer sending results!!");
}
Instance newInst = new DenseInstance(m_AttributeTypes.length);
for(int i = 0; i < m_AttributeTypes.length; i++) {
Object val = null;
if (i < key.length) {
val = key[i];
} else {
val = result[i - key.length];
}
if (val == null) {
newInst.setValue(i, Utils.missingValue());
} else {
switch (m_AttributeTypes[i]) {
case Attribute.NOMINAL:
String str = (String) val;
Double index = (Double)m_NominalIndexes[i].get(str);
if (index == null) {
index = new Double(m_NominalStrings[i].size());
m_NominalIndexes[i].put(str, index);
m_NominalStrings[i].addElement(str);
}
newInst.setValue(i, index.doubleValue());
break;
case Attribute.NUMERIC:
double dou = ((Double) val).doubleValue();
newInst.setValue(i, (double)dou);
break;
default:
newInst.setValue(i, Utils.missingValue());
}
}
}
m_Instances.addElement(newInst);
}