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); }
public EmployeeController(IDetail employeeDetail, IUnitOfWork unitOfWork, IMapper mapper, IAuthService authService) { _employeeDetail = employeeDetail; _unitOfWork = unitOfWork; _mapper = mapper; _authService = authService; }
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); }
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. }
public AirPlainController(IAirPlane airPlane, IBrand brand, IDetail detail, IAirPort airPort, IGallery gallery) { _brand = brand; _detail = detail; _airport = airPort; _gallery = gallery; _airplane = airPlane; }
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)); }
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; }
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)); }
/// <summary> /// /// </summary> private void LoadDetail() { IDetail detail = this.GetCurrentDetail(); if (detail != null) { detail.SetCredentials(this._credentials); detail.LoadData(); } }
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; }
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"); } }
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); }
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); }
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); }
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); }
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); }
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])); }
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; }
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("Ошибка работы проверяющей машины"); }
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); } } }
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); }
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); }