test_class.declarator: spreadsheetReader
test_class.modifier: private
test_class.original_string: private SpreadsheetReader spreadsheetReader;
test_class.type: SpreadsheetReader
test_class.var_name: spreadsheetReader
test_class.file: taverna-spreadsheet-import-activity/src/test/java/org/apache/taverna/activities/spreadsheet/CSVSpreadsheetReaderTest.java
test_class.identifier: CSVSpreadsheetReaderTest
test_case.body: @Test
  	public void testReadAllRows() throws Exception {
  		String[] testFiles2 = new String[] { "/test-spreadsheet.csv" };
  		for (int i = 0; i < testFiles2.length; i++) {
  			final List<Integer> rows = new ArrayList<Integer>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7,
  					8, 9, 10, 11, 12, 13, 14));
  			spreadsheetReader.read(getClass().getResourceAsStream(testFiles2[i]), new Range(0, -1), new Range(0, 4), false,
  					new SpreadsheetRowProcessor() {
  
  						public void processRow(int rowIndex, SortedMap<Integer, String> row) {
  							assertTrue(rows.remove((Integer) rowIndex));
  							List<Integer> columns = new ArrayList<Integer>(Arrays.asList(0, 1, 2,
  									3, 4));
  							for (Entry<Integer, String> cell : row.entrySet()) {
  								assertTrue(columns.remove(cell.getKey()));
  								if (rowIndex == 0) {
  									if (cell.getKey().equals(0)) {
  										assertEquals("A", cell.getValue());
  									} else if (cell.getKey().equals(1)) {
  										assertEquals("5", cell.getValue());
  									} else if (cell.getKey().equals(2)) {
  										assertEquals("C", cell.getValue());
  									} else if (cell.getKey().equals(3)) {
  										assertEquals("1", cell.getValue());
  									} else {
  										assertNull(cell.getValue());
  									}
  								} else if (rowIndex == 1) {
  									if (cell.getKey().equals(0)) {
  										assertEquals("A", cell.getValue());
  									} else if (cell.getKey().equals(1)) {
  										assertEquals("5", cell.getValue());
  									} else if (cell.getKey().equals(2)) {
  										assertEquals("C", cell.getValue());
  									} else if (cell.getKey().equals(3)) {
  										assertEquals("1", cell.getValue());
  									} else {
  										assertNull(cell.getValue());
  									}
  								} else if (rowIndex == 2) {
  									if (cell.getKey().equals(0)) {
  										assertEquals("TRUE", cell.getValue());
  									} else if (cell.getKey().equals(1)) {
  										assertEquals("15/06/09", cell.getValue());
  									} else if (cell.getKey().equals(2)) {
  										assertNull(cell.getValue());
  									} else if (cell.getKey().equals(3)) {
  										assertEquals("2", cell.getValue());
  									} else {
  										assertNull(cell.getValue());
  									}
  								} else if (rowIndex == 3 || rowIndex == 4) {
  									if (cell.getKey().equals(4)) {
  										assertNull(cell.getValue());
  									} else {
  										assertEquals("X", cell.getValue());
  									}
  								} else if (rowIndex == 5 || rowIndex == 6 || rowIndex == 7
  										|| rowIndex == 8) {
  									assertNull(cell.getValue());
  								} else if (rowIndex == 9 || rowIndex == 10 || rowIndex == 11
  										|| rowIndex == 12 || rowIndex == 13 || rowIndex == 14) {
  									if (cell.getKey().equals(4)) {
  										assertNull(cell.getValue());
  									} else {
  										assertEquals("y", cell.getValue());
  									}
  								}
  							}
  							assertTrue(columns.isEmpty());
  						}
  					});
  			assertTrue(rows.isEmpty());
  		}
  	}
test_case.class_method_signature: CSVSpreadsheetReaderTest.testReadAllRows()
test_case.full_signature: @Test public void testReadAllRows()
test_case.identifier: testReadAllRows
test_case.invocations: asList read getResourceAsStream getClass assertTrue remove asList entrySet assertTrue remove getKey equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertEquals getValue assertNull getValue equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertEquals getValue assertNull getValue equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertNull getValue equals getKey assertEquals getValue assertNull getValue equals getKey assertNull getValue assertEquals getValue assertNull getValue equals getKey assertNull getValue assertEquals getValue assertTrue isEmpty assertTrue isEmpty
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadAllRows()
focal_class.file: taverna-spreadsheet-import-activity/src/main/java/org/apache/taverna/activities/spreadsheet/CSVSpreadsheetReader.java
focal_class.identifier: CSVSpreadsheetReader
focal_class.interfaces: implements SpreadsheetReader
focal_class.class_method_signature: CSVSpreadsheetReader.read(InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
focal_class.full_signature: public void read(InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
focal_class.identifier: read
focal_class.modifiers: public
focal_class.parameters: (InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
focal_class.return: void
focal_class.signature: void read(InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
focal_method.body: public void read(InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
  			throws SpreadsheetReadException {
  		CsvReader csvReader = new CsvReader(new InputStreamReader(inputStream));
  		csvReader.setSkipEmptyRecords(false);
  
  		SortedMap<Integer, String> currentDataRow = new TreeMap<Integer, String>();
  
  		try {
  			while(csvReader.readRecord()) {
  				int rowIndex = (int) csvReader.getCurrentRecord();
  				boolean blankRow = true;
  				if (rowRange.contains(rowIndex)) {
  					for (int columnIndex = columnRange.getStart(); columnIndex <= columnRange.getEnd(); columnIndex++) {
  						if (columnRange.contains(columnIndex)) {
  							String value = csvReader.get(columnIndex);
  							value = "".equals(value) ? null : value;
  							if (value != null) {
  								blankRow = false;
  							}
  							currentDataRow.put(columnIndex, value);
  							if (columnIndex == columnRange.getEnd()) {
  								if (!ignoreBlankRows || !blankRow) {
  									rowProcessor.processRow(rowIndex, currentDataRow);
  								}
  								currentDataRow = new TreeMap<Integer, String>();
  							}
  						}
  					}
  				
  					if (rowIndex == rowRange.getEnd()) {
  						break;
  					}
  				}
  			}
  		} catch (IOException e) {
  			throw new SpreadsheetReadException("Unable to read CSV file", e);
  		}
  	}
focal_method.class_method_signature: CSVSpreadsheetReader.read(InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
focal_method.full_signature: public void read(InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
focal_method.identifier: read
focal_method.invocations: setSkipEmptyRecords readRecord getCurrentRecord contains getStart getEnd contains get equals put getEnd processRow getEnd
focal_method.modifiers: public
focal_method.parameters: (InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)
focal_method.return: void
focal_method.signature: void read(InputStream inputStream, Range rowRange,
  			Range columnRange, boolean ignoreBlankRows,
  			SpreadsheetRowProcessor rowProcessor)