Exemplo n.º 1
0
        private bool CheckStackSurroundings(int stackNumber, int containerAmount, IContainer container)
        {
            ContainerStack currentStack = GetSurroundingStack(stackNumber, 0);

            ContainerStack previousStack       = GetSurroundingStack(stackNumber, -1);
            ContainerStack secondPreviousStack = GetSurroundingStack(stackNumber, -2);

            ContainerStack nextStack       = GetSurroundingStack(stackNumber, 1);
            ContainerStack secondNextStack = GetSurroundingStack(stackNumber, 2);

            if (previousStack == null || secondPreviousStack == null)
            {
                return(true);
            }
            else if (previousStack.GetContainers().Count == 0 || secondPreviousStack.GetContainers().Count == 0)
            {
                return(true);
            }
            else if (!container.IsValuable)
            {
                return(CanNormalContainerBePlaced(containerAmount, previousStack, currentStack, nextStack, secondNextStack));
            }
            else if (container.IsValuable)
            {
                return(CanValuableContainerBePlaced(containerAmount, previousStack, nextStack));
            }

            return(false);
        }
Exemplo n.º 2
0
 private bool IsContainerAdded(ContainerStack stack, IContainer container)
 {
     if (IsStackAvialable(_containerStacks.IndexOf(stack), stack.GetContainers().Count + 1, container) && stack.AddContainerToList(container))
     {
         Weight += container.Weight;
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
 private bool CanValuableContainerBePlaced(int containerAmount, ContainerStack previousStack, ContainerStack nextStack)
 {
     if (containerAmount < previousStack.GetContainers().Count)
     {
         return(CheckNextStack(nextStack, containerAmount));
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        private bool CheckNextStack(ContainerStack nextStack, int containerAmount)
        {
            if (nextStack == null)
            {
                return(true);
            }

            if (containerAmount > nextStack.GetContainers().Count)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        private bool CheckNextStacks(ContainerStack nextStack, ContainerStack secondNextStack)
        {
            if (nextStack == null || secondNextStack == null)
            {
                return(true);
            }

            if (nextStack.IsTopContainerValuable() && nextStack.GetContainers().Count > secondNextStack.GetContainers().Count)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 6
0
 private bool CanNormalContainerBePlaced(int containerAmount, ContainerStack previousStack, ContainerStack currentStack, ContainerStack nextStack, ContainerStack secondNextStack)
 {
     if (containerAmount < previousStack.GetContainers().Count)
     {
         return(CheckNextStacks(nextStack, secondNextStack));
     }
     else if (currentStack.IsTopContainerValuable())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }