GJC.java 2.73 KB
package com.bsth.data.zndd.voice;

import java.util.*;

public enum GJC {
    CX(1, "撤销"),
    QX(1, "取消"),
    XZ(2, "新增"),
    TJ(2, "添加"),
    LJ(2, "临加"),
    TZ(3, "调整"),
    BC(4, "班次"),
    PB(4, "排班"),
    DF(5, "待发"),
    SF(6, "实发"),
    CC(7, "出场"),
    KQ(8, "开启"),
    GB(9, "关闭"),
    ge(10, "一个"),
    dao(11, "到"),
    de(12, "的班次"),

    jc(13, "进场");

    private  int code;
    private  String description;

    GJC(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static int getNumber(String description){
        int number = 999;
        for (GJC gjc : GJC.values()) {
            if(gjc.description.equals(description)){
                number = gjc.code;
            }
        }
        return number;
    }

    public static Set<String> getDescription(int number){
        Set<String> description = new HashSet<>();
        for (GJC gjc : GJC.values()) {
            if(gjc.code==number){
                description.add(gjc.description);
            }
        }
        return description;
    }

    public static Set<Integer> getGJC(String yy){
        Set<Integer> set=new HashSet<>();
        for (GJC gjc : GJC.values()) {
            char[] arr=gjc.description.toCharArray();
            for (char c : arr) {
                if(UploadVideoServlet.getPinyin(yy).contains(UploadVideoServlet.getPinyin(String.valueOf(c)))){
                    set.add(gjc.code);
                }
            }

        }
        return set;
    }

    public static int getCount(int i){
        int count=0;
        for (GJC gjc : GJC.values()) {
            if(gjc.code==i){
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(4);
        Set<String> ml=new HashSet<>();
        nestedLoop(list,"",ml);
        System.out.println(ml);
    }

    public static void nestedLoop(List<Integer> arr,String str,Set<String> ml) {
        if(arr.size()>0){
            Set<String> set=getDescription(arr.get(0));
            for (String s : set) {
                List list2=new ArrayList();
                list2.addAll(arr);
                list2.remove(0);
                nestedLoop(list2,str+s,ml);
            }
        }else {
            ml.add(str);
        }
    }


}