package com.qmth.boot.tools.excel.model;

import java.util.ArrayList;
import java.util.List;

public class RowData {

    private int row;

    private int columnCount;

    private List<String> list;

    public RowData(int row) {
        this.row = row;
        this.columnCount = 0;
        this.list = new ArrayList<>();
    }

    public void addValue(int column, String value) {
        while (column > this.columnCount) {
            list.add(null);
            this.columnCount++;
        }
        list.add(value);
        this.columnCount++;
    }

    public String[] getValues() {
        return list.toArray(new String[0]);
    }

    public String getValue(int column) {
        return column < this.columnCount ? list.get(column) : null;
    }

    public int getRow() {
        return row;
    }

}
