DataSet { public Object getValueAfterFiled(int rowNum, String colName) { if (!isInputVialid(rowNum)) { return null; } Record record = this.getRecordList().get(rowNum + 1); return record.getAttribute(colName).getValue(); } DataSet(List<Column> columns); protected  DataSet(List<Column> columns, List<Record> recordList); void initData(Object[][] input); void reset(); Collection<Attribute> getAttributesByColumn(String columnName); List<Column> getColumnList(); @Deprecated void survive(int recNum, String colName); void survive(int recNum, String colName, String ruleName); void surviveByAliveField(int recNum, String col, String aliveField); void eliminate(int recNum, String col); void finalizeComputation(); void arrangeConflictCol(String conflictCol, SurvivedResult survivoredRowNum); boolean checkDupSurValue(Object value, String colName); boolean isMostCommon(Object var, String column, boolean ignoreBlanks); boolean isMostComplete(int recNum); boolean isLongest(Object var, String column, boolean ignoreBlanks); boolean isShortest(Object var, String column, boolean ignoreBlanks); boolean isLatest(Object var, String column); boolean isEarliest(Object var, String column); boolean isLargest(Object var, String column); boolean isSmallest(Object var, String column); HashMap<String, Object> getSurvivorMap(); List<HashSet<String>> getConflictList(); HashSet<String> getConflictsOfSurvivor(); List<Record> getRecordList(); Object getValueAfterFiled(int rowNum, String colName); SoftReference<HashMap<String, List<Integer>>> getConflictDataMap(); List<Integer> getConflictDataIndexList(String colName); void addConfDataIndex(String colName, Integer index); SubDataSet createSubDataSet(String colName); HashMap<String, Integer> getSurvivorIndexMap(); List<Column> getColumnOrder(); void setColumnOrder(List<Column> columnOrder);  }
@Test public void testGetValueAfterFiled() { Column col1 = new Column("city1", "String"); Column col2 = new Column("city2", "String"); List<Column> columns = new ArrayList<>(); columns.add(col1); columns.add(col2); DataSet dataset = new DataSet(columns); Record record1 = new Record(); record1.setId(1); Attribute att1 = new Attribute(record1, col1, "value1"); Attribute att2 = new Attribute(record1, col2, "value2"); record1.putAttribute("city1", att1); record1.putAttribute("city2", att2); col1.putAttribute(record1, att1); col2.putAttribute(record1, att2); dataset.getRecordList().add(record1); record1 = new Record(); record1.setId(2); att1 = new Attribute(record1, col1, "value3"); att2 = new Attribute(record1, col2, "value4"); record1.putAttribute("city1", att1); record1.putAttribute("city2", att2); col1.putAttribute(record1, att1); col2.putAttribute(record1, att2); dataset.getRecordList().add(record1); List<Integer> conflictRowNum = new ArrayList<>(); conflictRowNum.add(0); dataset.getConflictDataMap().get().put("city2", conflictRowNum); Map<String, Integer> columnIndexMap = new HashMap<>(); columnIndexMap.put("city1", 0); columnIndexMap.put("city2", 1); Object valueAfterFiled = dataset.getValueAfterFiled(-1, "city1"); Assert.assertEquals("The value of first row on city1 column is value1", "value1", valueAfterFiled); valueAfterFiled = dataset.getValueAfterFiled(0, "city2"); Assert.assertEquals("The value of second row on city2 column is value4", "value4", valueAfterFiled); valueAfterFiled = dataset.getValueAfterFiled(-2, "city2"); Assert.assertEquals("The value of -1th row on city2 column is null", null, valueAfterFiled); valueAfterFiled = dataset.getValueAfterFiled(1, "city2"); Assert.assertEquals("The value of third row on city2 column is null", null, valueAfterFiled); }