List<LabelList> labels = new ArrayList<LabelList>();
try {
for(String line; (line = reader.readLine()) != null; lineNumber++) {
if(!line.startsWith(COMMENT) && line.length() > 0) {
List<String> entries = tokenize(line);
TDoubleList attributes = new TDoubleArrayList(entries.size());
LabelList labellist = null;
for(String entry : entries) {
try {
double attribute = Double.parseDouble(entry);
attributes.add(attribute);
}
catch(NumberFormatException e) {
if(labellist == null) {
labellist = new LabelList(1);
}
labellist.add(entry);
}
}
if(dimensionality < 0) {
dimensionality = attributes.size();
}
else if(dimensionality != attributes.size()) {
throw new IllegalArgumentException("Differing dimensionality in line " + lineNumber + ":" + attributes.size() + " != " + dimensionality);
}
vectors.add(ParameterizationFunction.STATIC.newNumberVector(attributes, ArrayLikeUtil.TDOUBLELISTADAPTER));
labels.add(labellist);
}
}