if (m_sourceReader != null) { if (m_incrementalReader != null) { current = m_incrementalReader.readInstance(m_structure); } else { if (getInstance(m_st) != null) {
if (m_sourceReader != null) { if (m_incrementalReader != null) { current = m_incrementalReader.readInstance(m_structure); } else { if (getInstance(m_st) != null) {
current = m_ArffReader.readInstance(m_structure);
while ((inst = m_ArffReader.readInstance(m_structure)) != null) { insts.add(inst);
current = m_ArffReader.readInstance(m_structure);
while ((inst = m_ArffReader.readInstance(m_structure)) != null) { insts.add(inst);
/** * Reads a single instance from the reader and appends it to the dataset. * Automatically expands the dataset if it is not large enough to hold the * instance. This method does not check for carriage return at the end of the * line. * * @param reader the reader * @return false if end of file has been reached * @throws IOException if the information is not read successfully * @deprecated instead of using this method in conjunction with the * <code>readInstance(Reader)</code> method, one should use the * <code>ArffLoader</code> or <code>DataSource</code> class * instead. * @see weka.core.converters.ArffLoader * @see weka.core.converters.ConverterUtils.DataSource */ @Deprecated public boolean readInstance(Reader reader) throws IOException { ArffReader arff = new ArffReader(reader, this, m_Lines, 1); Instance inst = arff.readInstance(arff.getData(), false); m_Lines = arff.getLineNo(); if (inst != null) { add(inst); return true; } else { return false; } }
/** * Reads the data without header according to the specified template. The * data can be accessed via the <code>getData()</code> method. * * @param reader the reader to use * @param template the template header * @param lines the lines read so far * @param fieldSepAndEnclosures an optional array of Strings containing the * field separator and enclosures to use instead of the defaults. * The first entry in the array is expected to be the single * character field separator to use; the remaining entries (if any) * are enclosure characters to use. * @throws IOException if something goes wrong * @see #getData() */ public ArffReader(Reader reader, Instances template, int lines, String... fieldSepAndEnclosures) throws IOException { this(reader, template, lines, 100, true, fieldSepAndEnclosures); Instance inst; while ((inst = readInstance(m_Data)) != null) { m_Data.add(inst); } compactify(); }
/** * Reads a single instance from the reader and appends it to the dataset. * Automatically expands the dataset if it is not large enough to hold the * instance. This method does not check for carriage return at the end of the * line. * * @param reader the reader * @return false if end of file has been reached * @throws IOException if the information is not read successfully * @deprecated instead of using this method in conjunction with the * <code>readInstance(Reader)</code> method, one should use the * <code>ArffLoader</code> or <code>DataSource</code> class * instead. * @see weka.core.converters.ArffLoader * @see weka.core.converters.ConverterUtils.DataSource */ @Deprecated public boolean readInstance(Reader reader) throws IOException { ArffReader arff = new ArffReader(reader, this, m_Lines, 1); Instance inst = arff.readInstance(arff.getData(), false); m_Lines = arff.getLineNo(); if (inst != null) { add(inst); return true; } else { return false; } }
/** * Reads the data without header according to the specified template. The * data can be accessed via the <code>getData()</code> method. * * @param reader the reader to use * @param template the template header * @param lines the lines read so far * @param fieldSepAndEnclosures an optional array of Strings containing the * field separator and enclosures to use instead of the defaults. * The first entry in the array is expected to be the single * character field separator to use; the remaining entries (if any) * are enclosure characters to use. * @throws IOException if something goes wrong * @see #getData() */ public ArffReader(Reader reader, Instances template, int lines, String... fieldSepAndEnclosures) throws IOException { this(reader, template, lines, 100, true, fieldSepAndEnclosures); Instance inst; while ((inst = readInstance(m_Data)) != null) { m_Data.add(inst); } compactify(); }
/** * Reads the data completely from the reader. The data can be accessed via * the <code>getData()</code> method. * * @param reader the reader to use * @throws IOException if something goes wrong * @see #getData() */ public ArffReader(Reader reader) throws IOException { m_retainStringValues = true; m_batchMode = true; m_Tokenizer = new StreamTokenizer(reader); initTokenizer(); readHeader(1000); initBuffers(); Instance inst; while ((inst = readInstance(m_Data)) != null) { m_Data.add(inst); } compactify(); }
/** * Reads the data completely from the reader. The data can be accessed via * the <code>getData()</code> method. * * @param reader the reader to use * @throws IOException if something goes wrong * @see #getData() */ public ArffReader(Reader reader) throws IOException { m_retainStringValues = true; m_batchMode = true; m_Tokenizer = new StreamTokenizer(reader); initTokenizer(); readHeader(1000); initBuffers(); Instance inst; while ((inst = readInstance(m_Data)) != null) { m_Data.add(inst); } compactify(); }
/** * Reads an ARFF file from a reader, and assigns a weight of one to each * instance. Lets the index of the class attribute be undefined (negative). * * @param reader the reader * @throws IOException if the ARFF file is not read successfully */ public Instances(/* @non_null@ */Reader reader) throws IOException { ArffReader arff = new ArffReader(reader, 1000, false); initialize(arff.getData(), 1000); arff.setRetainStringValues(true); Instance inst; while ((inst = arff.readInstance(this)) != null) { m_Instances.add(inst); } compactify(); }
/** * Reads an ARFF file from a reader, and assigns a weight of one to each * instance. Lets the index of the class attribute be undefined (negative). * * @param reader the reader * @throws IOException if the ARFF file is not read successfully */ public Instances(/* @non_null@ */Reader reader) throws IOException { ArffReader arff = new ArffReader(reader, 1000, false); initialize(arff.getData(), 1000); arff.setRetainStringValues(true); Instance inst; while ((inst = arff.readInstance(this)) != null) { m_Instances.add(inst); } compactify(); }
/** * Reads a single instance using the tokenizer and returns it. * * @param structure the dataset header information, will get updated in case * of string or relational attributes * @return null if end of file has been reached * @throws IOException if the information is not read successfully */ public Instance readInstance(Instances structure) throws IOException { return readInstance(structure, true); }
/** * Reads a single instance using the tokenizer and returns it. * * @param structure the dataset header information, will get updated in case * of string or relational attributes * @return null if end of file has been reached * @throws IOException if the information is not read successfully */ public Instance readInstance(Instances structure) throws IOException { return readInstance(structure, true); }