class MappingDataCSVSupport {

    public MappingData fromCSVRows(List<CSVRow> rows, int headlines) {
        MappingData data = new MappingData();
        if (rows.size()<=headlines) {
            throw new IllegalStateException("Row count must be > headline count:"+headlines);
        }
        int count=0;
        for (CSVRow row: rows) {
            count++;
            if (count<=headlines) {
                /* ignore headline */
                continue;
            }
            if (row.columns.size()!=3) {
                throw new IllegalStateException("column count must be 3, but is:"+row.columns.size());
            }
            int col=0;
            String pattern= row.columns.get(col++).cell;
            String replacement= row.columns.get(col++).cell;
            String comment= row.columns.get(col++).cell;
            
            data.getEntries().add(new MappingEntry(pattern,replacement,comment));
        }
        return data;
    }

}