Esempio n. 1
0
        public override void execute()
        {
            double expectedTime = (lengthOfWay / (car.getSpeed() / 60.0)) + time; // ocakavany cas - kolko autu trava cesta

            // poruchovost
            if (car.hasFailed())
            {
                expectedTime += car.getTimeOfRepair();
            }

            core.materialB += car.getVolume();
            if (core.materialB >= Constants.materialToLoad)
            {
                core.materialB = Constants.materialToLoad;
                return;
            }

            Event arrivalC = new EventArrivalToC(core, expectedTime, car);

            core.updateEventCalendar(arrivalC);

            Vehicle carInFront = core.getFirstBeforeBuilding();

            if (carInFront != null)
            {
                Event unloadStart = new EventUnloadStart(core, time, carInFront);
                core.updateEventCalendar(unloadStart);
            }
            else
            {
                core.unloadMachineWorking = false;
            }
        }
        public override void execute()
        {
            // postavia sa do radu
            core.updteListBeforeBuilding(car);
            // nastavi sa im pociatocny cas cakania
            car.setStartOfWaiting(time);
            // ak sa nic nenaklada, pride prve auto na rad

            if (core.unloadMachineWorking == false)
            {
                Event unloadStart = new EventUnloadStart(core, time, core.getFirstBeforeBuilding());
                core.updateEventCalendar(unloadStart);
                core.unloadMachineWorking = true;
            }
        }