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

import java.util.LinkedList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

import cn.com.qmth.stmms.biz.utils.ScoreItem;

public class ScoreEditDTO {

    private String examNumber;

    private String objectiveItems;

    private String subjectiveItems;

    public String getExamNumber() {
        return examNumber;
    }

    public void setExamNumber(String examNumber) {
        this.examNumber = examNumber;
    }

    public String getObjectiveItems() {
        return objectiveItems;
    }

    public void setObjectiveItems(String objectiveItems) {
        this.objectiveItems = objectiveItems;
    }

    public String getSubjectiveItems() {
        return subjectiveItems;
    }

    public void setSubjectiveItems(String subjectiveItems) {
        this.subjectiveItems = subjectiveItems;
    }

    public List<ScoreItem> getObjectiveScoreItems() {
        List<ScoreItem> list = new LinkedList<ScoreItem>();
        try {
            String[] values = StringUtils.split(objectiveItems, ";");
            for (String value : values) {
                ScoreItem item = ScoreItem.parse(value, true);
                if (item != null) {
                    item.setObjective(true);
                    list.add(item);
                }
            }
        } catch (Exception e) {
        }
        return list;
    }

    public List<ScoreItem> getSubjectiveScoreItems() {
        List<ScoreItem> list = new LinkedList<ScoreItem>();
        try {
            String[] values = StringUtils.split(subjectiveItems, ";");
            for (String value : values) {
                ScoreItem item = ScoreItem.parse(value, false);
                if (item != null) {
                    item.setObjective(false);
                    list.add(item);
                }
            }
        } catch (Exception e) {
        }
        return list;
    }
}
