Instances dataset,
Tuple tuple)
throws ActivityUserException
{
int columnCount = dataset.numAttributes();
Instance instance = new DenseInstance(columnCount);
instance.setDataset(dataset);
for (int i=0; i<columnCount; i++)
{
Attribute attribute = dataset.attribute(i);
// we only support numeric and nominal attributes for now
if (attribute.isDate())
{
Object value = tuple.getObject(i);
if (tuple.wasNull())
{
instance.setMissing(i);
}
// timestamp extends date
else
{
instance.setValue(i, ((Date)value).getTime());
}
}
else if (attribute.isNumeric())
{
double value = tuple.getDouble(i);
if (tuple.wasNull())
{
instance.setMissing(i);
}
else
{
instance.setValue(i, value);
}
}
else if (attribute.isNominal() || attribute.isString())
{
String value = tuple.getString(i);
if (tuple.wasNull())
{
instance.setMissing(i);
}
else
{
instance.setValue(i, value);
}
}
else
{
throw new ActivityUserException(