diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/datasource/parser/BitVectorLabelParser.java')
-rw-r--r-- | src/de/lmu/ifi/dbs/elki/datasource/parser/BitVectorLabelParser.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/datasource/parser/BitVectorLabelParser.java b/src/de/lmu/ifi/dbs/elki/datasource/parser/BitVectorLabelParser.java index cd206310..c62392b4 100644 --- a/src/de/lmu/ifi/dbs/elki/datasource/parser/BitVectorLabelParser.java +++ b/src/de/lmu/ifi/dbs/elki/datasource/parser/BitVectorLabelParser.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.datasource.parser; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team @@ -82,15 +82,18 @@ public class BitVectorLabelParser extends AbstractParser implements Parser { for(String line; (line = reader.readLine()) != null; lineNumber++) { if(!line.startsWith(COMMENT) && line.length() > 0) { List<String> entries = tokenize(line); - // TODO: use more efficient storage right away? + // FIXME: use more efficient storage right away? List<Bit> attributes = new ArrayList<Bit>(); - LabelList ll = new LabelList(); + LabelList ll = null; for(String entry : entries) { try { Bit attribute = Bit.valueOf(entry); attributes.add(attribute); } catch(NumberFormatException e) { + if(ll == null) { + ll = new LabelList(1); + } ll.add(entry); } } |