private boolean readData(boolean dump) throws IOException { if (m_sourceReader == null) { throw new IOException("No source has been specified"); } boolean finished = false; do { String checked = getInstance(m_st); if (checked == null) { return false; } if (dump) { dumpRow(checked); } m_rowBuffer.add(checked); if (m_rowBuffer.size() == m_bufferSize) { finished = true; if (getRetrieval() == BATCH) { m_rowBuffer.clear(); } } } while (!finished); return true; }
private boolean readData(boolean dump) throws IOException { if (m_sourceReader == null) { throw new IOException("No source has been specified"); } boolean finished = false; do { String checked = getInstance(m_st); if (checked == null) { return false; } if (dump) { dumpRow(checked); } m_rowBuffer.add(checked); if (m_rowBuffer.size() == m_bufferSize) { finished = true; if (getRetrieval() == BATCH) { m_rowBuffer.clear(); } } } while (!finished); return true; }
@Override public Instances getDataSet() throws IOException { if (m_sourceReader == null) { throw new IOException("No source has been specified"); } if (getRetrieval() == INCREMENTAL) { throw new IOException( "Cannot mix getting instances in both incremental and batch modes"); } setRetrieval(BATCH); if (m_structure == null) { getStructure(); } while (readData(true)) { ; } m_dataDumper.flush(); m_dataDumper.close(); // make final structure makeStructure(); Reader sr = new BufferedReader(new FileReader(m_tempFile)); ArffReader initialArff = new ArffReader(sr, m_structure, 0, m_fieldSeparatorAndEnclosures); Instances initialInsts = initialArff.getData(); sr.close(); initialArff = null; return initialInsts; }
@Override public Instances getDataSet() throws IOException { if (m_sourceReader == null) { throw new IOException("No source has been specified"); } if (getRetrieval() == INCREMENTAL) { throw new IOException( "Cannot mix getting instances in both incremental and batch modes"); } setRetrieval(BATCH); if (m_structure == null) { getStructure(); } while (readData(true)) { ; } m_dataDumper.flush(); m_dataDumper.close(); // make final structure makeStructure(); Reader sr = new BufferedReader(new FileReader(m_tempFile)); ArffReader initialArff = new ArffReader(sr, m_structure, 0, m_fieldSeparatorAndEnclosures); Instances initialInsts = initialArff.getData(); sr.close(); initialArff = null; return initialInsts; }
@Override public Instance getNextInstance(Instances structure) throws IOException { m_structure = structure; if (getRetrieval() == BATCH) { throw new IOException( "Cannot mix getting instances in both incremental and batch modes");
@Override public Instance getNextInstance(Instances structure) throws IOException { m_structure = structure; if (getRetrieval() == BATCH) { throw new IOException( "Cannot mix getting instances in both incremental and batch modes");
if (m_noHeaderRow && getRetrieval() == BATCH) { StreamTokenizer tempT = new StreamTokenizer(new StringReader(firstRow)); initTokenizer(tempT); readData(false || getRetrieval() == BATCH); makeStructure();
if (m_noHeaderRow && getRetrieval() == BATCH) { StreamTokenizer tempT = new StreamTokenizer(new StringReader(firstRow)); initTokenizer(tempT); readData(false || getRetrieval() == BATCH); makeStructure();