package cn.com.qmth.stmms.admin.dto;

import org.apache.commons.lang.StringUtils;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

public class ExamQuestionDTO {

    private Integer mainNumber;

    private String mainTitle;

    private String subNumber;

    private List<Double> scoreList;

    private List<Double> intervalScoreList;

    public Integer getMainNumber() {
        return mainNumber;
    }

    public void setMainNumber(Integer mainNumber) {
        this.mainNumber = mainNumber;
    }

    public String getSubNumber() {
        return subNumber;
    }

    public void setSubNumber(String subNumber) {
        this.subNumber = subNumber;
    }

    public String getMainTitle() {
        return mainTitle;
    }

    public void setMainTitle(String mainTitle) {
        this.mainTitle = mainTitle;
    }

    public List<Double> getScoreList() {
        return scoreList;
    }

    public void setScoreList(List<Double> scoreList) {
        this.scoreList = scoreList;
    }

    public List<Double> getIntervalScoreList() {
        return intervalScoreList;
    }

    public void setIntervalScoreList(List<Double> intervalScoreList) {
        this.intervalScoreList = intervalScoreList;
    }

    public String getScoreString() {
        DecimalFormat format = new DecimalFormat("####.###");
        List<String> list = new ArrayList<>();
        if (scoreList != null) {
            for (Double score : scoreList) {
                if (score != null) {
                    list.add(format.format(score));
                }
            }
        }
        return StringUtils.join(list, ",");
    }

}
