package com.prolog.eis.roadway_allocation;

import com.prolog.eis.dto.strategy.AreaInfoDto;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class AreaTaskNumStrategy extends AllocationStrategy<AreaInfoDto> {

    public AreaTaskNumStrategy(int order){
        this.order = order;
    }

    @Override
    public List<AreaInfoDto> sort(List<AreaInfoDto> list) {
        System.out.println("区域任务数排序");
        List<AreaInfoDto> collect = list.stream().sorted(Comparator.comparing(AreaInfoDto::getTaskNum)).collect(Collectors.toList());
        AreaInfoDto areaInfoDto = collect.get(0);
        List<AreaInfoDto> newAreaInfoDtoList = collect.stream().filter(x -> x.getTaskNum().equals(areaInfoDto.getTaskNum())).collect(Collectors.toList());
        System.out.println(newAreaInfoDtoList);
        return newAreaInfoDtoList;
    }
}
