JSONObject jsonRequest = new JSONObject(); putObjects( jsonRequest, "parent1Key", buildObject( new SimpleEntry( "child1Key1", "someValue" ) , new SimpleEntry( "child1Key2", "someValue" ) ) , buildObject( new SimpleEntry( "child2Key1", "someValue" ) , new SimpleEntry( "child2Key2", "someValue" ) ) );
private MatrixEntry advance() throws IOException { if (curRow >= rows) return null; // Check whether we have exhaused all the data points in the current // column if (curCol >= cols) { curCol = 0; curRow++; } // If the last row has been read, return null. if (curRow >= rows) { dis.close(); return null; } // Read the next data point and return it. return new SimpleEntry(curRow, curCol++, dis.readFloat()); }
private MatrixEntry advance() throws IOException { if (curRow >= rows) return null; // Check whether we have exhaused all the data points in the current // column if (curCol >= cols) { curCol = 0; curRow++; } // If the last row has been read, return null. if (curRow >= rows) { dis.close(); return null; } // Read the next data point and return it. return new SimpleEntry(curRow, curCol++, dis.readFloat()); }
private MatrixEntry advance() throws IOException { if (curRow >= rows) return null; // Check whether we have exhaused all the data points in the current // column if (curCol >= cols) { curCol = 0; curRow++; // If the last row has been read, return null. if (curRow >= rows) { reader.close(); return null; } curLine = reader.readLine().split("\\s+");; } // Read the next data point and return it. return new SimpleEntry(curRow, curCol, Double.parseDouble(curLine[curCol++])); }
private MatrixEntry advance() throws IOException { if (curLine == null) return null; // Check whether we have exhaused all the data points in the current // column if (curCol >= curLine.length) { curCol = 0; curRow++; // If the last row has been read, return null. String line = reader.readLine(); if (line == null) { curLine = null; reader.close(); return null; } curLine = line.split("\\s+");; } // Read the next data point and return it. return new SimpleEntry(curRow, curCol, Double.parseDouble(curLine[curCol++])); }
private MatrixEntry advance() throws IOException { if (curRow >= rows) return null; // Check whether we have exhaused all the data points in the current // column if (curCol >= cols) { curCol = 0; curRow++; // If the last row has been read, return null. if (curRow >= rows) { reader.close(); return null; } curLine = reader.readLine().split("\\s+");; } // Read the next data point and return it. return new SimpleEntry(curRow, curCol, Double.parseDouble(curLine[curCol++])); }
private MatrixEntry advance() throws IOException { if (curLine == null) return null; // Check whether we have exhaused all the data points in the current // column if (curCol >= curLine.length) { curCol = 0; curRow++; // If the last row has been read, return null. String line = reader.readLine(); if (line == null) { curLine = null; reader.close(); return null; } curLine = line.split("\\s+");; } // Read the next data point and return it. return new SimpleEntry(curRow, curCol, Double.parseDouble(curLine[curCol++])); }
private MatrixEntry advance() throws IOException { if (curCol >= cols) return null; // Check that there are still non zero values to read for the current // row. If not, advance to the next row. if (curNonZeros == 0) { curCol++; // If the last row has been read, return null. if (curCol >= cols) { reader.close(); return null; } // Read the next number of non zeros. curNonZeros = Integer.parseInt(reader.readLine()); } // Read a line and decrement the number of nonZeros that we expect to // process. Then return the created MatrixEntry. String[] rowValue = reader.readLine().split("\\s+"); curNonZeros--; return new SimpleEntry(Integer.parseInt(rowValue[0]), curCol, Double.parseDouble(rowValue[1])); }
private MatrixEntry advance() throws IOException { if (curCol >= cols) return null; // Check that there are still non zero values to read for the current // row. If not, advance to the next row. if (curNonZeros == 0) { curCol++; // If the last row has been read, return null. if (curCol >= cols) { reader.close(); return null; } // Read the next number of non zeros. curNonZeros = Integer.parseInt(reader.readLine()); } // Read a line and decrement the number of nonZeros that we expect to // process. Then return the created MatrixEntry. String[] rowValue = reader.readLine().split("\\s+"); curNonZeros--; return new SimpleEntry(Integer.parseInt(rowValue[0]), curCol, Double.parseDouble(rowValue[1])); }
private void advance() throws IOException { String line = matrixFileReader.readLine(); lineNo++; if (line == null) { next = null; // If the end of the file has been reached, close the reader matrixFileReader.close(); } else { String[] rowColVal = line.split("\\s+"); if (rowColVal.length != 3) throw new MatrixIOException( "Incorrect number of values on line: " + lineNo); int row = Integer.parseInt(rowColVal[0]) - 1; int col = Integer.parseInt(rowColVal[1]) - 1; double value = Double.parseDouble(rowColVal[2]); next = new SimpleEntry(row, col, value); } }
private void advance() throws IOException { String line = matrixFileReader.readLine(); lineNo++; if (line == null) { next = null; // If the end of the file has been reached, close the reader matrixFileReader.close(); } else { String[] rowColVal = line.split("\\s+"); if (rowColVal.length != 3) throw new MatrixIOException( "Incorrect number of values on line: " + lineNo); int row = Integer.parseInt(rowColVal[0]) - 1; int col = Integer.parseInt(rowColVal[1]) - 1; double value = Double.parseDouble(rowColVal[2]); next = new SimpleEntry(row, col, value); } }
private MatrixEntry advance() throws IOException { if (curRow >= rows) return null; // Check that there are still non zero values to read for the current // row. If not, advance to the next row. if (curColIndex >= curLine.length) { curColIndex = 0; curRow++; // If the last row has been read, return null. if (curRow >= rows) { reader.close(); return null; } curLine = readLine(); } // Parse the current column and value pair and return the corresponding // matrix entry. return new SimpleEntry(curRow, Integer.parseInt(curLine[curColIndex++]) - 1, Double.parseDouble(curLine[curColIndex++])); }
private MatrixEntry advance() throws IOException { if (curRow >= rows) return null; // Check that there are still non zero values to read for the current // row. If not, advance to the next row. if (curColIndex >= curLine.length) { curColIndex = 0; curRow++; // If the last row has been read, return null. if (curRow >= rows) { reader.close(); return null; } curLine = readLine(); } // Parse the current column and value pair and return the corresponding // matrix entry. return new SimpleEntry(curRow, Integer.parseInt(curLine[curColIndex++]) - 1, Double.parseDouble(curLine[curColIndex++])); }
private void advance() throws IOException { if (entry >= nzEntriesInMatrix) { next = null; // If the end of the file has been reached, close the reader dis.close(); } else { try { // Check whether we have exhaused all the data points in the // current column while (curColEntry == nzInCurCol) { curColEntry = 0; nzInCurCol = dis.readInt(); curCol++; } int row = dis.readInt(); double value = dis.readFloat(); next = new SimpleEntry(row, curCol, value); curColEntry++; entry++; } catch (IOException ioe) { // Rethrow wrapped exception throw new MatrixIOException( "Missing data when reading. Truncated file?", ioe); } } }
private void advance() throws IOException { if (entry >= nzEntriesInMatrix) { next = null; // If the end of the file has been reached, close the reader dis.close(); } else { try { // Check whether we have exhaused all the data points in the // current column while (curColEntry == nzInCurCol) { curColEntry = 0; nzInCurCol = dis.readInt(); curCol++; } int row = dis.readInt(); double value = dis.readFloat(); next = new SimpleEntry(row, curCol, value); curColEntry++; entry++; } catch (IOException ioe) { // Rethrow wrapped exception throw new MatrixIOException( "Missing data when reading. Truncated file?", ioe); } } }