/** * Reads the header of an ARFF file from a reader and reserves space for the * given number of instances. Lets the class index be undefined (negative). * * @param reader the reader * @param capacity the capacity * @throws IllegalArgumentException if the header is not read successfully or * the capacity is negative. * @throws IOException if there is a problem with the reader. * @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 */ // @ requires capacity >= 0; // @ ensures classIndex() == -1; @Deprecated public Instances(/* @non_null@ */Reader reader, int capacity) throws IOException { ArffReader arff = new ArffReader(reader, 0); Instances header = arff.getStructure(); initialize(header, capacity); m_Lines = arff.getLineNo(); }
/** * Reads the header of an ARFF file from a reader and reserves space for the * given number of instances. Lets the class index be undefined (negative). * * @param reader the reader * @param capacity the capacity * @throws IllegalArgumentException if the header is not read successfully or * the capacity is negative. * @throws IOException if there is a problem with the reader. * @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 */ // @ requires capacity >= 0; // @ ensures classIndex() == -1; @Deprecated public Instances(/* @non_null@ */Reader reader, int capacity) throws IOException { ArffReader arff = new ArffReader(reader, 0); Instances header = arff.getStructure(); initialize(header, capacity); m_Lines = arff.getLineNo(); }
m_Data.attribute(m_IndicesBuffer[numValues]).addRelation(data); } catch (Exception e) { throw new IOException(e.toString() + " of line " + getLineNo());
m_Data.attribute(m_IndicesBuffer[numValues]).addRelation(data); } catch (Exception e) { throw new IOException(e.toString() + " of line " + getLineNo());
instance[i] = m_Data.attribute(i).addRelation(data); } catch (Exception e) { throw new IOException(e.toString() + " of line " + getLineNo());
instance[i] = m_Data.attribute(i).addRelation(data); } catch (Exception e) { throw new IOException(e.toString() + " of line " + getLineNo());
/** * 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 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; } }