예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Organizer bagaznika. Wesja 1.0");
            Console.WriteLine("******************************\n");

            Trunk bagaznik = new Trunk(50, 50, 50);

            Console.WriteLine("Bagaznik: {0}\n", bagaznik);

            listaBagazy.addLuggage(new Suitcase(24, 26, 26));
            listaBagazy.addLuggage(new Suitcase(24, 26, 26));

            DebugSupporter.printPropertyValue(nameof(listaBagazy), listaBagazy);
            DebugSupporter.printPropertyValue("listaBagazy.getLength()", listaBagazy.getLength());

            /*
             *          listaBagazy.addLuggage(new Suitcase(10, 50, 70));
             *          listaBagazy.addLuggage(new Suitcase(20, 30, 40));
             *          listaBagazy.addLuggage(new Suitcase(99, 12, 17));
             *          listaBagazy.addLuggage(new Suitcase(51, 14, 13));
             *          listaBagazy.addLuggage(new Suitcase(71, 18, 98));
             *          listaBagazy.addLuggage(new Suitcase(99, 12, 17));
             *          listaBagazy.addLuggage(new Suitcase(51, 99, 13));
             *          listaBagazy.addLuggage(new Suitcase(71, 18, 99));
             */

            LuggageCalc optymalizatorBagaznika = new LuggageCalc(listaBagazy, bagaznik);

            Console.WriteLine("Lista nieposortowana:");
            Console.WriteLine("******************************\n");
            Console.WriteLine(listaBagazy);
        }
예제 #2
0
        public bool evaluateTrunkSize()
        {
            bool volumeOK = checkSingleVolumeOfEveryLuggage() && checkSummaryVolume();
            bool dimXYZOK = checkXYZdimensions();

            string debugMessage = String.Format("Volume OK: {0}, XYZ OK: {1}", volumeOK, dimXYZOK);

            DebugSupporter.printCustomMessage(debugMessage);

            return(volumeOK && dimXYZOK);
        }
예제 #3
0
        private bool checkSingleVolumeOfEveryLuggage()
        {
            bool volumeIsEnough = true;

            string debugMessage = String.Format("Dlugosc listy bagazy w TrunkSizeChecker: {0}", luggageList.getLength());

            DebugSupporter.printCustomMessage(debugMessage);

            for (int i = 0; i < luggageList.getLength(); i++)
            {
                volumeIsEnough = volumeIsEnough & checkSingleVolume(luggageList.getLuggage(i));
            }
            return(volumeIsEnough);
        }
예제 #4
0
        private bool checkSingleVolume(IContainer luggage)
        {
            bool isLuggageVolumeSmaller = false;

            if (luggage.getVolume() < trunk.getVolume())
            {
                isLuggageVolumeSmaller = true;
            }

            string debugMessage = String.Format("Luggage volume: {0}, Trunk volume: {1}, Evaluation: {2}", luggage.getVolume(), trunk.getVolume(), isLuggageVolumeSmaller);

            DebugSupporter.printCustomMessage(debugMessage);

            return(isLuggageVolumeSmaller);
        }
예제 #5
0
        public LuggageCalc(LuggageList luggageList, IContainer trunk)
        {
            if (luggageList == null || trunk == null)
            {
                throw new ArgumentNullException("Luggage list or trunk not existing");
            }

            this.luggageList = luggageList;
            this.trunk       = (Trunk)trunk;

            TrunkSizeChecker checkTrunksSize = new TrunkSizeChecker(luggageList, trunk);

            isTrunkBigEnough = checkTrunksSize.evaluateTrunkSize();

            DebugSupporter.printPropertyValue(nameof(isTrunkBigEnough), isTrunkBigEnough);
        }