package com.qmth.distributed.print;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Date: 2021/8/9.
 */
public class RandomABCTest {
    
    private final static String TYPE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    public static void main(String[] args) {
        int count = 5;
        List<String> types = generateType(count);
        List<Student> students = generateStudent();
        int i = 0;
        for (Student student : students) {
            int mod = i % count;
            student.setType(types.get(mod));
            student.print();
            i++;
        }
    }
    
    static List<String> generateType(int count){
        String types = TYPE.substring(0, count);
        return Arrays.asList(types.split(""));
    }

    static List<Student> generateStudent(){
        List<Student> list = new ArrayList<>();
        for (int i = 1; i <= 20; i++) {
            Student student = new Student();
            student.setId(i);
            student.setName("学生"+i);
            list.add(student);
        }
        return list;
    }

    static class Student{
        private int id;
        private String name;
        private String type;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public void print(){
            System.out.println("id:" + id +", type:" + type);
        }
    }
}
