package com.yem.ensign.common;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 区间类
 */
public class QuestionnaireItem implements Serializable {
    private static final long serialVersionUID = -2850886454687095222L;
    private String minValue;
    private String maxValue;
    //"范围符号:1-大于/2-小于/3-等于/4-不等于/5-大于等于/6-小于等于/7-全闭区间/8-左闭右开区间/9-左开右闭区间/10-全开区间"
    private Byte symbol;

    public QuestionnaireItem( String minValue, String maxValue, Byte symbol) {
        this.minValue = minValue;
        this.maxValue = maxValue;
        this.symbol = symbol;
    }

    public String getMinValue() {
        return minValue;
    }

    public void setMinValue(String minValue) {
        this.minValue = minValue;
    }

    public String getMaxValue() {
        return maxValue;
    }

    public void setMaxValue(String maxValue) {
        this.maxValue = maxValue;
    }

    public Byte getSymbol() {
        return symbol;
    }

    public void setSymbol(Byte symbol) {
        this.symbol = symbol;
    }

    public static void main(String[] args) {
        //示例
        List<QuestionnaireItem> list = new ArrayList<QuestionnaireItem>();
        //范围1
        String symboll = "A";
        String symbolr = "B";
        Byte symbol = null;
        if("A".equals(symboll) && "A".equals(symbolr)) {
            symbol = 7;
        }else if("A".equals(symboll) && "B".equals(symbolr)) {
            symbol = 8;
        }else if("B".equals(symboll) && "A".equals(symbolr)) {
            symbol = 9;
        }else if("B".equals(symboll) && "B".equals(symbolr)) {
            symbol = 10;
        }
        QuestionnaireItem item = new QuestionnaireItem("1", "10", symbol);
        list.add(item);

        //范围2
        symboll = "A";
        symbolr = "B";
        symbol = null;
        if("A".equals(symboll) && "A".equals(symbolr)) {
            symbol = 7;
        }else if("A".equals(symboll) && "B".equals(symbolr)) {
            symbol = 8;
        }else if("B".equals(symboll) && "A".equals(symbolr)) {
            symbol = 9;
        }else if("B".equals(symboll) && "B".equals(symbolr)) {
            symbol = 10;
        }
        item = new QuestionnaireItem("5", "20", symbol);
        list.add(item);

        boolean result = SectionUtil.compareSection(list);
        if(result) {
            String msg = "系数分录存在重叠数据，请检查！";
            System.out.println(msg);
        }
    }
}