Esempio n. 1
0
        public override int CompareTo(IDetail other)
        {
            var s = other as Shackle;

            if (s == null)
            {
                return(-1);
            }
            var res = AcadLib.Comparers.AlphanumComparator.New.Compare(Mark, s.Mark);

            if (res != 0)
            {
                return(res);
            }

            res = L.CompareTo(s.L);
            if (res != 0)
            {
                return(res);
            }

            res = H.CompareTo(s.H);
            if (res != 0)
            {
                return(res);
            }

            res = tail.CompareTo(s.tail);
            return(res);
        }
Esempio n. 2
0
 public EmployeeController(IDetail employeeDetail, IUnitOfWork unitOfWork, IMapper mapper, IAuthService authService)
 {
     _employeeDetail = employeeDetail;
     _unitOfWork     = unitOfWork;
     _mapper         = mapper;
     _authService    = authService;
 }
Esempio n. 3
0
        private (List <Task <bool> >, List <ICheckMachine>) StartFourCheckMachines(IDetail detail)
        {
            cancellationTokenSource = new CancellationTokenSource(); //Для нового набора задач нужен новый экземпляр, иначе
                                                                     //все новые задачи при запуске сразу отменяются
            CancellationToken token = cancellationTokenSource.Token;

            Task <bool> task = checkMachine.CheckDetail(detail, token);

            Task <bool> task1 = checkMachine1.CheckDetail(detail, token);

            Task <bool> task2 = checkMachine2.CheckDetail(detail, token);

            Task <bool> task3 = checkMachine3.CheckDetail(detail, token);

            List <Task <bool> > list = new List <Task <bool> >()
            {
                task,
                task1,
                task2,
                task3
            };

            List <ICheckMachine> listCurrentCheckMachines = new List <ICheckMachine>()
            {
                checkMachine,
                checkMachine1,
                checkMachine2,
                checkMachine3,
            };

            (List <Task <bool> >, List <ICheckMachine>)result = (list, listCurrentCheckMachines);

            return(result);
        }
Esempio n. 4
0
 public void Add(IDetail detail)
 {
     lock (Details)
     {
         Details.Add(detail);
     }
 }
 public static void Main()
 {
     Program   P                  = new Program();        //Creating an instance.
     IAssembly iAssebly           = ((IAssembly)P);       //Casting it to IAssembly.
     IDetail   iDetail            = ((IDetail)P);         //Casting it to IDetail.
     IAssembly iDetailToIAssembly = ((IAssembly)iDetail); //Casting IDetail to IAssemmbly.
     IDetail   iAssemblyToIDetail = ((IDetail)iAssebly);  //Casting IAssemmbly to IDetail.
 }
Esempio n. 6
0
 public AirPlainController(IAirPlane airPlane, IBrand brand, IDetail detail, IAirPort airPort, IGallery gallery)
 {
     _brand    = brand;
     _detail   = detail;
     _airport  = airPort;
     _gallery  = gallery;
     _airplane = airPlane;
 }
Esempio n. 7
0
 public HotelController(IPlace place, IAddress address, IDetail detail, IGallery gallery, ICategory category)
 {
     _gallery  = gallery;
     _address  = address;
     _place    = place;
     _detail   = detail;
     _category = category;
 }
        public IDetail CreateDetail(IDetail detail)
        {
            if (rnd.Next(10) == 5)//10% - процент брака
            {
                return(new Nail(1, 1, 2));
            }

            return(new Nail(0.2, 0.3, 4));
        }
Esempio n. 9
0
 public InstituteController(IPlace place, IAddress address, IDetail detail, ILinks links, IGallery gallery, ICategory category)
 {
     _place    = place;
     _address  = address;
     _detail   = detail;
     _links    = links;
     _gallery  = gallery;
     _category = category;
 }
Esempio n. 10
0
 private void EnqueueDetail(IDetail detail)
 {
     if (details.Count >= maxDetailsCount)
     {
         QueueIsFull("Очередь заполнена");
         return;
     }
     details.Enqueue(detail);
 }
        public IDetail GetDetail()
        {
            IDetail detail = CreateDetail();

            indexOfDetail++;
            detail.NumberOfDetail = indexOfDetail;

            return(detail);
        }
        public IDetail CreateDetail(IDetail detail)
        {
            if (rnd.Next(10) == 5)//10% - процент брака
            {
                return(new Bolt(1, 1, 2));
            }

            return(new Bolt(0.5, 0.5, 3));
        }
        public IDetail CreateDetail(IDetail detail)
        {
            if (rnd.Next(10) == 5)//10% - процент брака
            {
                return(new Wheel(1, 1, 2));
            }

            return(new Wheel(10, 4, 10));
        }
Esempio n. 14
0
        /// <summary>
        ///
        /// </summary>
        private void LoadDetail()
        {
            IDetail detail = this.GetCurrentDetail();

            if (detail != null)
            {
                detail.SetCredentials(this._credentials);
                detail.LoadData();
            }
        }
Esempio n. 15
0
 public ParkingController(IPlace place, IAirPort airPort, IAddress address, IDetail detail, ICategory category, ICity city, IState state)
 {
     _place    = place;
     _airport  = airPort;
     _address  = address;
     _detail   = detail;
     _category = category;
     _city     = city;
     _state    = state;
 }
Esempio n. 16
0
 private void DisplayCheckedDetail(IDetail detail, Task <bool> taskResult, ICheckMachine currentCheckMachines)
 {
     if (taskResult.Result == true)
     {
         display.WriteLine($"The CheckMachine \"{currentCheckMachines.Model}\" checked {detail.GetType().Name} №{detail.NumberOfDetail} - fine");
     }
     else
     {
         display.WriteLine($"The CheckMachine \"{currentCheckMachines.Model}\" checked {detail.GetType().Name} №{detail.NumberOfDetail} - trash");
     }
 }
Esempio n. 17
0
        private static ITriviaFactory <T> GetFactory <T>(OutputContext context, IDetail item)
            where T : class
        {
            var itemAsT = item as T;

            if (itemAsT != null)
            {
                return(context.Corporation.GetTriviaFactory <T>());
            }
            return(null);
        }
        public bool CheckDetail(IDetail detail)
        {
            if (detail.Height == nailExample.Height ||
                detail.Width == nailExample.Width ||
                detail.Length == nailExample.Length)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 19
0
        public override bool Equals(IDetail other)
        {
            var b = other as Bracket;

            if (b == null)
            {
                return(false);
            }
            var res = L == b.L && T == b.T;

            return(res);
        }
Esempio n. 20
0
        public override bool Equals(IDetail other)
        {
            var s = other as Shackle;

            if (s == null)
            {
                return(false);
            }
            var res = L == s.L && H == s.H && tail == s.tail;

            return(res);
        }
Esempio n. 21
0
        public override bool Equals(IDetail other)
        {
            var b = other as BentBarDirect;

            if (b == null)
            {
                return(false);
            }
            var res = LStart == b.LStart && LEnd == b.LEnd && HDif == b.HDif && LDif == b.LDif;

            return(res);
        }
Esempio n. 22
0
        public override bool Equals(IDetail other)
        {
            var s = other as Spring;

            if (s == null)
            {
                return(false);
            }
            var res = LRab == s.LRab && tail == s.tail;

            return(res);
        }
Esempio n. 23
0
        public override bool Equals(IDetail other)
        {
            var b = other as BentBarLshaped;

            if (b == null)
            {
                return(false);
            }
            var res = L == b.L && H == b.H;

            return(res);
        }
        private IDetail CreateDetail()
        {
            IDetail bolt  = new Bolt();
            IDetail nail  = new Nail();
            IDetail screw = new Screw();
            IDetail wheel = new Wheel();

            IDetail[] details = new IDetail[] { bolt, nail, screw, wheel };

            int index = rnd.Next(4);

            return(checkerContainer.CreateDetail(details[index]));
        }
Esempio n. 25
0
 public FlightController(IFlight flight, IDetail detail, IAirPlane airPlane, IAirPort airPort, IFlightStatus flightStatus, IGate gate, IWeather weather, ITypeDetail typeDetail, ICustomer customer, ICustomerFlight customerFlight, IAirline airline, ICity city, IAddress address)
 {
     _flight         = flight;
     _detail         = detail;
     _airPlane       = airPlane;
     _airport        = airPort;
     _flightStatus   = flightStatus;
     _gate           = gate;
     _Weatger        = weather;
     _TypeDetail     = typeDetail;
     _customer       = customer;
     _customerFlight = customerFlight;
     _airline        = airline;
     _city           = city;
     _address        = address;
 }
Esempio n. 26
0
        private void OneStep()
        {
            try
            {
                IDetail detail = machine.GetDetail();

                PutDetailOnConveyorAndMoveOneStep(detail);

                CheckConveyorAndDetail();

                Thread.Sleep(2000);
            }
            catch (ConveyorException ex)
            {
                display.WriteLine(ex.Message);
                RestartOrCloseAfterError();
            }
            catch (CheckMachineException ex)
            {
                display.WriteLine(ex.Message);
                RestartOrCloseAfterError();
            }
        }
        public Task <bool> CheckDetail(IDetail detail, CancellationToken token)
        {
            return(Task.Run <bool>(async() =>
            {
                if (TryBrokeCheckMachine() == false)
                {
                    await Task.Delay(rnd.Next(750));

                    token.ThrowIfCancellationRequested();

                    return checkerContainer.CheckDetail(detail);
                }
                else
                {
                    throw new CheckMachineException("All machines could not examine the detail. It was eliminated");
                }
            }, token));
            //if (love programming ())
            //{
            //    SayMyau('chikiryau');
            //}
            //throw new CheckMachineException("Ошибка работы проверяющей машины");
        }
Esempio n. 28
0
        private async void CheckDetail(IDetail detail)
        {
            try
            {
                var tasksAndMachines = StartFourCheckMachines(detail);

                var listTasks = tasksAndMachines.Item1;
                var listCurrentCheckMachines = tasksAndMachines.Item2;

                Task <bool> resultTask = await CheckAndCancelTasks(listTasks, listCurrentCheckMachines);

                ICheckMachine currentCheckMachine = GetLastCurrentCheckMachine(resultTask, listTasks, listCurrentCheckMachines);

                DisplayCheckedDetail(detail, resultTask, currentCheckMachine);
            }
            catch (AggregateException ex)
            {
                foreach (var oneException in ex.InnerExceptions)
                {
                    display.WriteLine(oneException.Message);
                }
            }
        }
Esempio n. 29
0
        public override int CompareTo(IDetail other)
        {
            var b = other as Bracket;

            if (b == null)
            {
                return(-1);
            }
            var res = AcadLib.Comparers.AlphanumComparator.New.Compare(Mark, b.Mark);

            if (res != 0)
            {
                return(res);
            }

            res = L.CompareTo(b.L);
            if (res != 0)
            {
                return(res);
            }

            res = T.CompareTo(b.T);
            return(res);
        }
Esempio n. 30
0
        public override int CompareTo(IDetail other)
        {
            var b = other as BentBarDirect;

            if (b == null)
            {
                return(-1);
            }
            var res = AcadLib.Comparers.AlphanumComparator.New.Compare(Mark, b.Mark);

            if (res != 0)
            {
                return(res);
            }

            res = LStart.CompareTo(b.LStart);
            if (res != 0)
            {
                return(res);
            }

            res = LEnd.CompareTo(b.LEnd);
            if (res != 0)
            {
                return(res);
            }

            res = HDif.CompareTo(b.HDif);
            if (res != 0)
            {
                return(res);
            }

            res = LDif.CompareTo(b.LDif);
            return(res);
        }