package cn.com.qmth.stmms.biz.mark.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

public class MarkStepDTO implements Serializable {

    private static final long serialVersionUID = 3542801746602688750L;

    private String questionNumber;

    private int blockId;

    private int number;

    private String title;

    private boolean hasLevel;

    private double totalScore;

    private double max;

    private double min;

    private double defaultScore;

    private double interval;

    private double[] scoreList;

    private String remark;

    private List<TrackDTO> trackList = new ArrayList<TrackDTO>();

    public String getQuestionNumber() {
        return questionNumber;
    }

    public void setQuestionNumber(String questionNumber) {
        this.questionNumber = questionNumber;
    }

    public double[] getScoreArray() {
        return scoreList;
    }

    public double[] getScoreList() {
        return scoreList;
    }

    public void setScoreList(double[] scoreList) {
        this.scoreList = scoreList;
    }

    public void setScoreList(String scoreListValue) {
        String[] values = StringUtils.split(StringUtils.trimToEmpty(scoreListValue), ",");
        if (values != null && values.length > 0) {
            List<Double> list = new ArrayList<Double>(values.length);
            for (String value : values) {
                try {
                    list.add(Double.valueOf(value));
                } catch (Exception e) {
                    continue;
                }
            }
            int length = list.size();
            if (length > 0) {
                double[] array = new double[length];
                for (int i = 0; i < length; i++) {
                    array[i] = list.get(i);
                }
                this.scoreList = array;
            }
        }
    }

    public int getBlockId() {
        return blockId;
    }

    public void setBlockId(int blockId) {
        this.blockId = blockId;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public boolean isHasLevel() {
        return hasLevel;
    }

    public void setHasLevel(boolean hasLevel) {
        this.hasLevel = hasLevel;
    }

    public double getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(double totalScore) {
        this.totalScore = totalScore;
    }

    public double getMax() {
        return max;
    }

    public void setMax(double max) {
        this.max = max;
    }

    public double getMin() {
        return min;
    }

    public void setMin(double min) {
        this.min = min;
    }

    public double getDefaultScore() {
        return defaultScore;
    }

    public void setDefaultScore(double defaultScore) {
        this.defaultScore = defaultScore;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public double getInterval() {
        return interval;
    }

    public void setInterval(double interval) {
        this.interval = interval;
    }

    public List<TrackDTO> getTrackList() {
        return trackList;
    }

    public void setTrackList(List<TrackDTO> trackList) {
        this.trackList = trackList;
    }

    public void addTrack(TrackDTO track) {
        this.trackList.add(track);
    }

}
