public void T3_stations_can_be_found_by_name() { ICity s = CityFactory.CreateCity("Paris"); IStation c1 = s.AddStation("Opera", 0, 0); s.FindStation("Opera").Should().BeSameAs(c1); s.FindStation("Chatelet").Should().BeNull(); IStation c2 = s.AddStation("Chatelet", 1, 1); s.FindStation("Opera").Should().BeSameAs(c1); s.FindStation("Chatelet").Should().BeSameAs(c2); s.FindStation("Ivry").Should().BeNull(); IStation c3 = s.AddStation("Ivry", 2, 2); IStation c4 = s.AddStation("Villejuif", 3, 3); IStation c5 = s.AddStation("Bourse", 4, 4); s.FindStation("Opera").Should().BeSameAs(c1); s.FindStation("Chatelet").Should().BeSameAs(c2); s.FindStation("Ivry").Should().BeSameAs(c3); s.FindStation("Villejuif").Should().BeSameAs(c4); s.FindStation("Bourse").Should().BeSameAs(c5); }
public static void CallToSubscriber(IStation station, ITerminal callingTerminal, ITerminal calledTerminal) { if (callingTerminal.PortUsed.Id != null && calledTerminal.PortUsed.Id != null) { if (callingTerminal.PortUsed.Status == PortStatus.Busy && calledTerminal.PortUsed.Status == PortStatus.Busy) { lock (someLock) { CallPort(callingTerminal.PortUsed, callingTerminal); EventMessage += callingTerminal.MessageCall; } lock (someLock) { CallPort(calledTerminal.PortUsed, calledTerminal); EventMessage += calledTerminal.MessageCall; } } else { throw new GeneralizedException("One or both terminals are not available for a call."); } } else { throw new DisconnectTerminalException(); } }
/// <summary> /// /// </summary> /// <param name="task"></param> /// <returns></returns> private ICommuniPort GetCommuniPort(ITask task) { IDevice device = task.Device; IStation station = device.Station; return(station.CommuniPort); }
/// <summary> /// /// </summary> /// <param name="hd"></param> private void CreateDevices(Hardware hd) { // device // foreach (IDPU dpu in this.DPUs) { IDeviceSourceProvider deviceSourceProvider = dpu.DeviceSourceProvider; deviceSourceProvider.SourceConfigs = this.SourceConfigs; IDeviceSource[] deviceSources = deviceSourceProvider.GetDeviceSources(); foreach (IDeviceSource deviceSource in deviceSources) { IDeviceFactory factory = dpu.DeviceFactory; IDevice device = factory.Create(deviceSource); device.DeviceSource = deviceSource; // find station by device // Guid stationGuid = deviceSource.StationGuid; IStation station = hd.Stations.Find(stationGuid); if (station == null) { string s = string.Format("not find station by guid '{0}'", stationGuid); throw new Exception(s); } station.Devices.Add(device); device.Station = station; ITaskFactory taskFactory = dpu.TaskFactory; taskFactory.Create(device); } } }
public IStation GetStationTest([PexAssumeUnderTest] global::BarkNPark.System target, StationCode code) { IStation result = target.GetStation(code); return(result); // TODO: add assertions to method SystemTest.GetStationTest(System, StationCode) }
/// <summary> /// /// </summary> /// <param name="station"></param> private void DoStation(IStation station) { foreach (IDevice device in station.Devices) { DoDevice(device); } }
private void releaseProductFromStation(Product product, IStation station) { if (station != null && product != null && station.CurrentProduct != null && station.CurrentProduct.Name == product.Name) { station.ReleaseProduct(); } }
public void RegisterStation(IStation station) { if (station != null) { this.Station = station; } }
private List <IStation> findWatingProducts(IStation station) { List <IStation> result = new List <IStation>(); try { foreach (IStation cStation in this.lineStations) { Product product = cStation.CurrentProduct; if (product != null && cStation.IsFinished) { List <string> nextStationNames = product.Router.NextStationNames(cStation.Name); if (nextStationNames.Contains(station.Name)) { result.Add(cStation); } } } return(result); } catch (Exception ex) { //this.myLog.LogAlert(AlertType.Error, this.name, this.GetType().ToString(), "findWatingProduct()", ex.ToString(), "system"); Console.WriteLine(ex); } return(result); }
private IStation findWatingProduct(IStation station) { IStation result = null; try { for (int i = this.lineStations.Count() - 1; i >= 0; i--) { IStation cStation = this.lineStations.ElementAt(i); Product product = cStation.CurrentProduct; if (product != null && cStation.IsFinished) { List <string> nextStationNames = product.Router.NextStationNames(cStation.Name); foreach (string nextStName in nextStationNames) { if (nextStName == station.Name) { //this.MoveProduct(product, cStation); result = cStation; return(result); } } } } } catch (Exception ex) { //this.myLog.LogAlert(AlertType.Error, this.name, this.GetType().ToString(), "findWatingProduct()", ex.ToString(), "system"); Console.WriteLine(ex); } return(result); }
private bool checkIfNextStateFinal(Product product, IStation station) { bool result = false; string productName = product != null ? product.Name : "product is null"; if (product.Router.IsNextStateFinal) { this.myLog.LogAlert(AlertType.System, id.ToString(), this.GetType().ToString(), "moveProduct()", productName + " finished the line!", "system"); // tell station to remove the product this.releaseProductFromStation(product, station); // tell owner to remove the product from the line if (this.OnProductFinishedLine != null) { this.OnProductFinishedLine(this, new DispatcherMoveArgs() { Product = product }); } // exit, because moving is not needed result = true; } return(result); }
public override void HandleOrder(Order o) { lastOrder = o.type; if (o.type == eOrderType.MOVE) { if (assigned) { assigned = false; assigneStation.RemoveWorker(); animator.SetTrigger("StopWork"); } movable.MoveTo(o.position); } if (o.type == eOrderType.WORK) { if (assigned) { assigned = false; assigneStation.RemoveWorker(); } movable.MoveTo(o.position); targetStation = o.station; } }
protected override void Update() { base.Update(); if (lastOrder == eOrderType.WORK && movable.hasReachedPosition) { if (targetStation.AssignWorker()) { assigned = true; animator.SetTrigger("StartWork"); assigneStation = targetStation; } lastOrder = eOrderType.NONE; } if (assigned && assigneStation.tag == "Truck") { Truck truck = (Truck)assigneStation; if (truck.state != Truck.eState.UNLOADING) { assigned = false; assigneStation.RemoveWorker(); animator.SetTrigger("StopWork"); } } }
public static void AnswerTheCall(IStation station, ITerminal callingTerminal, ITerminal calledTerminal) { if (callingTerminal.PortUsed.Id != null && calledTerminal.PortUsed.Id != null) { if (callingTerminal.PortUsed.Status == PortStatus.Call && calledTerminal.PortUsed.Status == PortStatus.Call) { lock (someLock) { callingTerminal.SubscriberNumber.CallLog.Add(new CallLog(callingTerminal.SubscriberNumber)); TalkPort(callingTerminal.PortUsed, callingTerminal); EventMessage += callingTerminal.MessageTalk; } lock (someLock) { TalkPort(calledTerminal.PortUsed, calledTerminal); EventMessage += calledTerminal.MessageTalk; } } else { throw new GeneralizedException("One or both terminals are not available to answer the call."); } } else { throw new DisconnectTerminalException(); } }
public IStation getFirstAvailableStationTest([PexAssumeUnderTest] global::BarkNPark.System target) { IStation result = target.getFirstAvailableStation(); return(result); // TODO: add assertions to method SystemTest.getFirstAvailableStationTest(System) }
public Error GetTroopObject(out ITroopObject troopObject) { if (newTroopObject != null) { troopObject = newTroopObject; return(Error.Ok); } if (stub.State != TroopState.Stationed) { troopObject = null; return(Error.TroopNotStationed); } originalStation = stub.Station; if (!stub.Station.Troops.RemoveStationed(stub.StationTroopId)) { troopObject = null; return(Error.TroopNotStationed); } troopObject = stub.City.CreateTroopObject(stub, originalStation.PrimaryPosition.X, originalStation.PrimaryPosition.Y + 1); newTroopObject = troopObject; troopObject.BeginUpdate(); troopObject.Stats = new TroopStats(formula.GetTroopRadius(stub, null), formula.GetTroopSpeed(stub)); world.Regions.Add(troopObject); troopObject.EndUpdate(); return(Error.Ok); }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.Crs = new Crs(this); this.Delays = new Delays(this); this.Service = new Service(this); this.Station = new Station(this); this.BaseUri = new Uri("https://kanehuxleyapi.azurewebsites.net:443"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
public WeatherStation(IStation station) { Name = station.Name; StationId = station.StationId; State = station.State; GeoLongitude = station.GeoLongitude; GeoLatitude = station.GeoLatitude; }
public static void DeleteStation(IBillingCompany billingCompany, IStation station) { if (!billingCompany.Stations.Contains(station)) { return; } billingCompany.Stations.Remove(station); }
// EXPLORATION public virtual void Explore(IStation station, string description) { this.Station = station; this.textBoxStatus.Text = description; Text += ": " + description; Show(); }
public void ConnectStation(IStation station, bool isViceVersa) { ConnectedStations.Add(station); if (isViceVersa == true) { station.ConnectStation(this, false); } }
public void FailedAnimate(IStation station) { _facePrefab.GetComponent <SpriteRenderer>().DOFade(0.0f, _failFadeDuration).Play(); _labelPrefab.GetComponent <SpriteRenderer>().DOFade(0.0f, _failFadeDuration).Play(); _passengerPrefab.GetComponent <SpriteRenderer>().DOFade(0.0f, _failFadeDuration).Play().OnComplete(() => { MonoBehaviour.Destroy(_passengerPrefab); station.RearrangePassengersView(); }); }
public TestProvider(IStation station, IBillingSystem billingSystem) { if (station == null) throw new ArgumentNullException(nameof(station)); if (billingSystem == null) throw new ArgumentNullException(nameof(billingSystem)); this._station = station; this._billingSystem = billingSystem; billingSystem.RegisterStation(station); }
public void DeleteAbonent(IAbonent abonent) { IStation station = GetStationByPhoneNumberContains(abonent.PhoneNumber); IPort port = station.Ports.FirstOrDefault(p => p.PhoneNumber == abonent.PhoneNumber); port.OutcomingCall -= station.CallingRequest; port.CallTerminate -= station.OnCallTerminate; _abonentList.Remove(abonent); }
public void RestoreProductOnStation(Product product, string stationName) { IStation station = this.lineStations.FirstOrDefault(p => p.Name.Equals(stationName)); if (station != null) { station.AddProduct(product); } }
public void StartJourney(IStation station) { if (CurrentJourneyStartFrom != null) { throw new JourneyException("A Journey is already underway"); } CurrentJourneyStartFrom = station ?? throw new ArgumentNullException(nameof(station)); }
public MyInstanceProvider(IStation dep) { if (dep == null) { throw new ArgumentNullException("dep"); } this.dep = dep; }
public override void SubscriptionToStationEvents(IStation station) { station.CallIsProcessed += (sender, call) => { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Statistics: {0}", call); Console.ForegroundColor = ConsoleColor.Gray; }; }
public override void OnAdd(IStation station) { //throw new NotImplementedException(); Station st = (Station)station; string xml = CommuniPortConfigSerializer.Serialize(st.CommuniPortConfig); int id = DBI.Instance.InsertStation(st.Name, xml, st.Ordinal, st.Street, st.Remark); st.Guid = GuidHelper.Create((uint)id); }
private void RegisterHandlerForStation(IStation station) { station.CallService.Call += (sender, callInfo) => { var user = GetUserByTerminal(sender as Terminal); CallService.SetAdditionalInfo(user, callInfo); CallService.AddCall(callInfo); }; }
public void InvokeTakeoffCompleted(IStation runway) { var res = Serialize(runway); if (res != null) { AirportActions.TakeoffCompletedAction?.Invoke(res); } }
public DialogResult Add(DeviceType deviceType, IStation station, out IDevice newDevice) { if (deviceType == null) { throw new ArgumentNullException("deviceType"); } if (station == null) { throw new ArgumentNullException("station"); } return OnAdd(deviceType, station, out newDevice); }
/// <summary> /// /// </summary> /// <param name="deviceType"></param> /// <param name="station"></param> /// <param name="newDevice"></param> /// <returns></returns> protected override DialogResult OnAdd(DeviceType deviceType, IStation station, out IDevice newDevice) { newDevice = null; FrmDeviceGroups f = new FrmDeviceGroups(); f.DeviceType = deviceType; //f.Device = (IDevice)Activator.CreateInstance(f.DeviceType.Type); f.Device = f.DeviceType.Create(this.Dpu); f.Station = station; f.AdeStatus = ADEStatus.Add; f.Groups = f.Device.Groups; DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { newDevice = f.Device; } return dr; }
/// <summary> /// /// </summary> /// <param name="stationType"></param> /// <param name="newStation"></param> /// <returns></returns> public DialogResult Add(StationType stationType, StationCollection stations, out IStation newStation) { newStation = null; Debug.Assert(stationType != null); Debug.Assert(stations != null); FrmStationGroups f = new FrmStationGroups(); f.AdeStatus = ADEStatus.Add; f.StationType = stationType; f.Stations = stations; f.Station = stationType.Create(this.Spu); f.Groups = f.Station.Groups; DialogResult dr = f.ShowDialog(); if (dr == DialogResult.OK) { newStation = f.Station; } return dr; }
/// <summary> /// /// </summary> /// <param name="station"></param> public StationTreeNode(IStation station) { this.Station = station; RefreshStationTreeNode(station); // // station.CommuniPortChanged += new EventHandler(station_CommuniPortChanged); // // //this.ImageKey = IconNames.Disconnect; //this.SelectedImageKey = IconNames.Disconnect; SetImageKey(IconNames.Disconnect); station.Tag = this; foreach (IDevice device in station.Devices) { DeviceTreeNode deviceNode = new DeviceTreeNode(device); this.Nodes.Add(deviceNode); } }
protected virtual void PropagateOnClassicalTransmit(IStation station, IClassicalState state) { _counterTransmitedClassical++; if (OnClassicalTransmit != null) { OnClassicalTransmit(this, state); }; }
protected void PropagateOnReceive(IStation station, IInformationState state) { if (OnReceive != null) { OnReceive(this, state); }; }
public void RegisterStation(IStation station) { station.ConnectionFailedEvent += ProcessConnectionFailed; station.CallEndEvent += ProcessCall; }
protected virtual void PropagateOnQuantumReceive(IStation station, IQuantumState state) { _counterReceivedQuantum++; if (OnQuantumReceive != null) { OnQuantumReceive(this, state); }; }
private static void Reroute(Route r, IStation closest, IStation destination) { Sim target = r.Follower.Target as Sim; Vector3 currentStartPoint = r.GetCurrentStartPoint(); float distanceRemaining = r.GetDistanceRemaining(); Route route = target.CreateRoute(); route.SetOption(Route.RouteOption.EnableSubwayPlanning, false); route.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false); route.SetOption(Route.RouteOption.EnablePlanningAsCar, r.GetOption(Route.RouteOption.EnablePlanningAsCar)); route.SetOption(Route.RouteOption.PlanUsingStroller, r.GetOption(Route.RouteOption.PlanUsingStroller)); route.SetOption(Route.RouteOption.ReplanUsingStroller, r.GetOption(Route.RouteOption.ReplanUsingStroller)); route.SetOption(Route.RouteOption.BeginAsStroller, r.GetOption(Route.RouteOption.BeginAsStroller)); Slot routeEnterEndSlot = closest.RouteEnterEndSlot; if (routeEnterEndSlot != Slot.None) { GameObject routingSlotEnterFootprint = closest.RoutingSlotEnterFootprint; if (routingSlotEnterFootprint != null) { route.AddObjectToIgnoreForRoute(routingSlotEnterFootprint.ObjectId); } if (route.PlanToSlot(closest, routeEnterEndSlot).Succeeded()) { Slot routeExitBeginSlot = destination.RouteExitBeginSlot; Vector3 slotPosition = destination.GetSlotPosition(routeExitBeginSlot); GameObject routingSlotExitFootprint = destination.RoutingSlotExitFootprint; if (routingSlotExitFootprint != null) { r.AddObjectToIgnoreForRoute(routingSlotExitFootprint.ObjectId); } r.SetOption(Route.RouteOption.EnableSubwayPlanning, false); r.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, false); if (!r.ReplanFromPoint(slotPosition).Succeeded()) { r.ReplanFromPoint(currentStartPoint); } else if ((route.GetDistanceRemaining() + r.GetDistanceRemaining()) < (distanceRemaining + SimRoutingComponent.kDistanceMustSaveInOrderToUseSubway)) { if (closest is IHoverTrainStation) { r.ReplanAllowed = false; Route route2 = target.CreateRoute(); PathType elevatedTrainPath = PathType.ElevatedTrainPath; List<Vector3> list = new List<Vector3>(); list.Add(closest.GetSlotPosition(closest.RouteEnterEndSlot)); list.Add(destination.GetSlotPosition(destination.RouteExitBeginSlot)); if (list.Count > 0) { route2.InsertCustomPathAtIndex(0, list.ToArray(), false, true, elevatedTrainPath); route2.ReplanAllowed = false; RoutePlanResult planResult = route2.PlanResult; planResult.mType = RoutePlanResultType.Succeeded; route2.PlanResult = planResult; PathData pathData = route2.GetPathData(0); pathData.ObjectId = destination.ObjectId; pathData.PathType = PathType.ElevatedTrainPath; route2.SetPathData(ref pathData); r.InsertRouteSubPathsAtIndex(0, route2); } } r.InsertRouteSubPathsAtIndex(0x0, route); r.SetOption(Route.RouteOption.EnableSubwayPlanning, true); r.SetOption2(Route.RouteOption2.EnableHoverTrainPlanning, true); } else { r.ReplanFromPoint(currentStartPoint); } } } }
public abstract void OnAdd(IStation station);
private StationMaintainInfo convertToMaintainInfoFromObj(IStation temp) { StationMaintainInfo station = new StationMaintainInfo(); station.Station = temp.StationId; //station.StationType = temp.StationType; station.OperationObject = temp.OperationObject; station.Cdt = temp.Cdt; station.Descr = temp.Descr; station.Editor = temp.Editor; station.Udt = temp.Udt; return station; }
/// <summary> This method copy's each database field into the <paramref name="target"/> interface. </summary> public void Copy_To(IStation target, bool includePrimaryKey = false) { if (includePrimaryKey) target.Id = this.Id; target.NameId = this.NameId; target.SortOrder = this.SortOrder; target.Title = this.Title; target.RblNummer = this.RblNummer; target.Gate = this.Gate; target.Lat = this.Lat; target.Lon = this.Lon; target.ParentStationId = this.ParentStationId; target.ColorARGBWert = this.ColorARGBWert; target.LastUpdateToken = this.LastUpdateToken; }
protected virtual void PropagateOnQuantumTransmit(IStation station, IQuantumState state) { _counterTransmitedQuantum++; if (OnQuantumTransmit != null) { OnQuantumTransmit(this, state); }; }
protected override void PropagateOnQuantumReceive(IStation station, IQuantumState state) { base.PropagateOnQuantumReceive(station, state); }
public void Add(IStation station) { OnAdd(station); }
/// <summary> /// /// </summary> /// <param name="station"></param> private void RefreshStationTreeNode(IStation station) { this.Name = station.Name; this.Text = station.Name; }
public void Update(IStation station) { OnUpdate(station); }
/// <summary> This method copy's each database field from the <paramref name="source"/> interface to this data row.</summary> public void Copy_From(IStation source, bool includePrimaryKey = false) { if (includePrimaryKey) this.Id = source.Id; this.NameId = source.NameId; this.SortOrder = source.SortOrder; this.Title = source.Title; this.RblNummer = source.RblNummer; this.Gate = source.Gate; this.Lat = source.Lat; this.Lon = source.Lon; this.ParentStationId = source.ParentStationId; this.ColorARGBWert = source.ColorARGBWert; this.LastUpdateToken = source.LastUpdateToken; }
/// <summary> /// This method copy's each database field which is in the <paramref name="includedColumns"/> /// from the <paramref name="source"/> interface to this data row. /// </summary> public void Copy_From_But_TakeOnly(IStation source, params string[] includedColumns) { if (includedColumns.Contains(StationenTable.IdCol)) this.Id = source.Id; if (includedColumns.Contains(StationenTable.NameIdCol)) this.NameId = source.NameId; if (includedColumns.Contains(StationenTable.SortOrderCol)) this.SortOrder = source.SortOrder; if (includedColumns.Contains(StationenTable.TitleCol)) this.Title = source.Title; if (includedColumns.Contains(StationenTable.RblNummerCol)) this.RblNummer = source.RblNummer; if (includedColumns.Contains(StationenTable.GateCol)) this.Gate = source.Gate; if (includedColumns.Contains(StationenTable.LatCol)) this.Lat = source.Lat; if (includedColumns.Contains(StationenTable.LonCol)) this.Lon = source.Lon; if (includedColumns.Contains(StationenTable.ParentStationIdCol)) this.ParentStationId = source.ParentStationId; if (includedColumns.Contains(StationenTable.ColorARGBWertCol)) this.ColorARGBWert = source.ColorARGBWert; if (includedColumns.Contains(StationenTable.LastUpdateTokenCol)) this.LastUpdateToken = source.LastUpdateToken; }
protected virtual void PropagateOnClassicalReceive(IStation station, IClassicalState state) { _counterReceivedClassical++; if (OnClassicalReceive != null) { OnClassicalReceive(this, state); }; }
protected void PropagateOnTransmit(IStation station, IInformationState state) { if (OnTransmit != null) { OnTransmit(this, state); }; }
public abstract void OnUpdate(IStation station);
public abstract void OnDelete(IStation station);
public void Delete(IStation station) { OnDelete(station); }
public StationModel(IStation station) { this._station = station; this.ControllerType = typeof(StationController); }
protected override void PropagateOnClassicalReceive(IStation station, IClassicalState state) { IClassicalBit tempBit = FactoryClassicalData.generateBit(false); tempBit.AssociateState(state); ReceivedData.Add(FactoryClassicalData.decodeBitByUsualBasis(tempBit)); base.PropagateOnClassicalReceive(station,state); }
/// <summary> /// /// </summary> /// <param name="deviceType"></param> /// <param name="station"></param> /// <param name="newDevice"></param> /// <returns></returns> protected abstract DialogResult OnAdd(DeviceType deviceType, IStation station, out IDevice newDevice);