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 EmptyStoreStrategy extends AllocationStrategy<AreaInfoDto>{

    public EmptyStoreStrategy(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::getEmptyStoreNum)).collect(Collectors.toList());
        AreaInfoDto areaInfoDto = collect.get(0);
        List<AreaInfoDto> newAreaInfoDtoList = collect.stream().filter(x -> x.getEmptyStoreNum().equals(areaInfoDto.getEmptyStoreNum())).collect(Collectors.toList());
        System.out.println(newAreaInfoDtoList);
        return newAreaInfoDtoList;
    }
}
