Esempio n. 1
0
        public List <ContainerCooled> getContainersCooledSorted(List <IContainer> containers)
        {
            List <IContainer>      clonedList = new List <IContainer>(containers);
            List <ContainerCooled> sortedList = new List <ContainerCooled>();

            foreach (ContainerCooled container in containers.OfType <ContainerCooled>())
            {
                ContainerCooled maxContainerCooled = getMaxWeightContainerCooled(clonedList);
                sortedList.Add(maxContainerCooled);
                clonedList.Remove(maxContainerCooled);
            }
            return(sortedList);
        }
Esempio n. 2
0
        public ContainerCooled getMaxWeightContainerCooled(List <IContainer> containers)
        {
            int             maxWeight          = 0;
            ContainerCooled maxWeightContainer = null;

            foreach (ContainerCooled container in containers.OfType <ContainerCooled>())
            {
                if (container.weight > maxWeight)
                {
                    maxWeightContainer = container;
                    maxWeight          = container.weight;
                }
            }
            return(maxWeightContainer);
        }