• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IVehicle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IVehicle的典型用法代码示例。如果您正苦于以下问题:C# IVehicle类的具体用法?C# IVehicle怎么用?C# IVehicle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IVehicle类属于命名空间,在下文中一共展示了IVehicle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VehicleTireReading

        public VehicleTireReading(IVehicle CurrentVehicle)
        {
            Id = Guid.NewGuid();
            CurrentTires = CurrentVehicle.Tires;
            ReadingTimeStamp = DateTime.UtcNow;
            CurrrentDistanceTraveled = CurrentVehicle.OdometerInMiles;
            ReadingId = createReadingHashKey(ReadingTimeStamp, CurrentVehicle.Id);
            VehicleId = CurrentVehicle.Id;
            TypeOfCar = CurrentVehicle.VehicleType;
            Readings = new List<TireReading>();
            int maxSpeed = 0;
            int lastSpeed = 0;

            foreach (CarTire ct in CurrentTires)
            {
                TireReading currentReading = new TireReading(this, ct);
                lastSpeed = ct.GetCurrentSpeed();
                //Capture the last speed
                if (lastSpeed > CurrentSpeed)
                {
                    CurrentSpeed = lastSpeed;
                }
                maxSpeed = ct.MaxSpeedRating;
                Readings.Add(currentReading);
            }
        }
开发者ID:GSIAzureCOE,项目名称:TPMSIoTDemo,代码行数:26,代码来源:VehicleTireReading.cs


示例2: StopVehicle

        public override void StopVehicle(IVehicle car)
        {
            switch (car.RadioState)
            {
                case RadioState.AM:
                case RadioState.FM:
                case RadioState.XM:
                case RadioState.CD:
                case RadioState.Off:
                    {
                        car.RadioState = RadioState.Off;
                        break;
                    }
                default:
                    {
                        car.RadioState = RadioState.Auxilary;
                        break;
                    }
            }

            car.MessageLog.Add("The car radio state was set.");

            if (car.FuelType == FuelType.JetFuel)
            {
                this.RunEngineCoolingProcess(car);
            }

            base.StopVehicle(car);
        }
开发者ID:justinsaraceno,项目名称:SampleLibrary,代码行数:29,代码来源:Car.cs


示例3: Ticket

 public Ticket(IVehicle vehicle, decimal payedMoney, string parkedPlace, int endTime)
 {
     this.Vehicle = vehicle;
     this.PayedMoney = payedMoney;
     this.ParkedPlace = parkedPlace;
     this.EndTime = endTime;
 }
开发者ID:peterkirilov,项目名称:SoftUni-1,代码行数:7,代码来源:Ticket.cs


示例4: SteerToAvoid

        // XXX 4-23-03: Temporary work around (see comment above)
        //
        // Checks for intersection of the given spherical obstacle with a
        // volume of "likely future vehicle positions": a cylinder along the
        // current path, extending minTimeToCollision seconds along the
        // forward axis from current position.
        //
        // If they intersect, a collision is imminent and this function returns
        // a steering force pointing laterally away from the obstacle's center.
        //
        // Returns a zero vector if the obstacle is outside the cylinder
        //
        // xxx couldn't this be made more compact using localizePosition?
        public Vector3 SteerToAvoid(IVehicle v, float minTimeToCollision)
        {
            // minimum distance to obstacle before avoidance is required
            float minDistanceToCollision = minTimeToCollision * v.Speed;
            float minDistanceToCenter = minDistanceToCollision + Radius;

            // contact distance: sum of radii of obstacle and vehicle
            float totalRadius = Radius + v.Radius;

            // obstacle center relative to vehicle position
            Vector3 localOffset = Center - v.Position;

            // distance along vehicle's forward axis to obstacle's center
            float forwardComponent = Vector3.Dot(localOffset, v.Forward);
            Vector3 forwardOffset = v.Forward * forwardComponent;

            // offset from forward axis to obstacle's center
            Vector3 offForwardOffset = localOffset - forwardOffset;

            // test to see if sphere overlaps with obstacle-free corridor
            bool inCylinder = offForwardOffset.Length() < totalRadius;
            bool nearby = forwardComponent < minDistanceToCenter;
            bool inFront = forwardComponent > 0;

            // if all three conditions are met, steer away from sphere center
            if (inCylinder && nearby && inFront)
            {
                return offForwardOffset * -1;
            }
            else
            {
                return Vector3.Zero;
            }
        }
开发者ID:Simie,项目名称:SharpSteer2,代码行数:47,代码来源:SphericalObstacle.cs


示例5: StartParking

        public void StartParking(IVehicle vehicle)
        {
            Parking parking;
            if (_startTimes == null) //normal operation
            {
                parking = new Parking
                {
                    Vehicle = vehicle,
                    StartTime = DateTime.Now,
                    EndTime = default(DateTime)
                };
            }
            else //set startTime manually for testing
            {
                parking = new Parking
                {
                    Vehicle = vehicle,
                    StartTime = _startTimes[0],
                    EndTime = default(DateTime)
                };
                _startTimes.RemoveAt(0);
            }

            _currentParkings.Add(parking);
        }
开发者ID:martin1,项目名称:parkinggarage,代码行数:25,代码来源:MockParkingRepository.cs


示例6: StartParking

        public void StartParking(IVehicle vehicle)
        {
            int numberOfOccupiedParkingSpots = _parkingService.GetNumberOfCurrentParkings();

            //check vehicle measurements
            if (vehicle.LengthInMeters > ParkingSpotLengthInMeters || vehicle.WidthInMeters > ParkingSpotWidthInMeters)
            {
                throw new VehicleSizeException("This vehicle is too large to fit in a parking spot");
            }

            if (numberOfOccupiedParkingSpots == NumberOfParkingSpots)
            {
                //this could happen if the last empty 10% of parking spots are taken by customers with contracts and noone stops parking at that time
                throw new ParkingException("Parking garage is full");
            }

            //check contract
            if (_parkingService.HasParkingContract(vehicle))
            {
                _parkingService.StartParking(vehicle);
            }
            else // no contract
            {
                //check that at least 10% of parking spots are reserved for customers with contracts before allowing to park

                if (numberOfOccupiedParkingSpots < NumberOfParkingSpots - RequiredFreeParkingSpots)
                {
                    _parkingService.StartParking(vehicle);
                }
                else
                {
                    throw new ParkingException("Remaining free parking spots reserved for customers with contracts");
                }
            }
        }
开发者ID:martin1,项目名称:parkinggarage,代码行数:35,代码来源:ParkingGarage.cs


示例7: PrintTicket

        private StringBuilder PrintTicket(decimal paidMoney, IVehicle vehicle, int parkingHours, int sector, int place)
        {
            var totalDueSum = (vehicle.ReservedHours * vehicle.RegularRate) +
                (parkingHours > vehicle.ReservedHours ?
                (parkingHours - vehicle.ReservedHours) *
                vehicle.OvertimeRate : 0);
            var change = paidMoney -
                         ((vehicle.ReservedHours * vehicle.RegularRate) +
                          (parkingHours > vehicle.ReservedHours
                              ? (parkingHours - vehicle.ReservedHours) * vehicle.OvertimeRate
                              : 0));
            var overtimeRtae = parkingHours > vehicle.ReservedHours
                ? (parkingHours - vehicle.ReservedHours) * vehicle.OvertimeRate
                : 0;

            var ticket = new StringBuilder();
            ticket.AppendLine(new string('*', 20))
                .AppendFormat("{0}", vehicle.ToString()).AppendLine()
                .AppendFormat("at place ({0},{1})", sector, place).AppendLine()
                .AppendFormat("Rate: ${0:F2}", vehicle.ReservedHours * vehicle.RegularRate).AppendLine()
                .AppendFormat("Overtime rate: ${0:F2}", overtimeRtae).AppendLine()
                .AppendLine(
                new string('-', 20))
                .AppendFormat("Total: ${0:F2}", totalDueSum).AppendLine()
                .AppendFormat("Paid: ${0:F2}", paidMoney).AppendLine().AppendFormat(
                "Change: ${0:F2}", change).AppendLine().Append(new string('*', 20));
            return ticket;
        }
开发者ID:PlamenaMiteva,项目名称:Quality-Programming-Code,代码行数:28,代码来源:ExitvehicleTests.cs


示例8: SimpleTrainMovingStrategy

 public SimpleTrainMovingStrategy(IVehicle vehicle)
 {
     _time = 0;
     _vehicle = vehicle;
     _timer = new Timer { Interval = _interval };
     _timer.Elapsed += (sender, args) => { _time++; };
 }
开发者ID:ashlex,项目名称:TrainModeling,代码行数:7,代码来源:SimpleTrainMovingStrategy.cs


示例9: Park

 protected string Park(IVehicle car)
 {
     if (this.Occupied) {
         throw new ApplicationException("Can't park a car in a full space");
     }
     this.ParkedCar = car;
     return this.Id;
 }
开发者ID:Farga83,项目名称:Algs4,代码行数:8,代码来源:ParkingSpace.cs


示例10: LuxuryCar

 public LuxuryCar(IVehicle vehicleControls,
             IAudioControl audioControls,
             IOperateSunRoof sunRoofControls)
 {
     _vehicleControls = vehicleControls;
     _audioControls = audioControls;
     _sunRoofControls = sunRoofControls;
 }
开发者ID:rajthapa2,项目名称:solid,代码行数:8,代码来源:LuxuryCar.cs


示例11: CreateSaloon

 public virtual IVehicle CreateSaloon()
 {
     if (saloon == null)
     {
         saloon = new Saloon(new StandardEngine(1300));
     }
     return (IVehicle)saloon.Clone();
 }
开发者ID:phoenixproject,项目名称:csdpe,代码行数:8,代码来源:VehicleManagerLazy.cs


示例12: StopVehicle

 public virtual void StopVehicle(IVehicle vehicle)
 {
     if (vehicle.EngineState == EngineState.Started)
     {
         vehicle.EngineState = EngineState.Stopped;
         vehicle.MessageLog.Add("Stopped the vehicle.");
     }
 }
开发者ID:justinsaraceno,项目名称:SampleLibrary,代码行数:8,代码来源:Vehicle.cs


示例13: StartVehicle

        public override void StartVehicle(IVehicle car)
        {
            if (car.FuelType == FuelType.Diesel)
            {
                base.WarmGlowplugs(car);
            }

            base.StartVehicle(car);
        }
开发者ID:justinsaraceno,项目名称:SampleLibrary,代码行数:9,代码来源:Car.cs


示例14: Household

 public Household(int id, ITashaPerson[] persons, IVehicle[] vehicles, float expansion, IZone zone)
 {
     //this.auxiliaryTripChains = new List<ITripChain>(7);
     HouseholdId = id;
     Persons = persons;
     Vehicles = vehicles;
     ExpansionFactor = expansion;
     HomeZone = zone;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:9,代码来源:Household.cs


示例15: InsertVehicleInDatabase

 public void InsertVehicleInDatabase(IVehicle vehicle, int sector, DateTime startTime, string place)
 {
     this.VehiclesInParkPlaces[vehicle] = place;
     this.ParkPlaces[place] = vehicle;
     this.VehiclesByLicensePlate[vehicle.LicensePlate] = vehicle;
     this.VehiclesByStartTime[vehicle] = startTime;
     this.VehiclesByOwner[vehicle.Owner].Add(vehicle);
     this.SpacesCount[sector - 1]++;
 }
开发者ID:ikolev94,项目名称:Exercises,代码行数:9,代码来源:Data.cs


示例16: GetExpectedTimeForVehicle

        public DateTime GetExpectedTimeForVehicle(IVehicle vehicle)
        {
            if (!this.expectedTimePerVehicle.ContainsKey(vehicle))
            {
                throw new InvalidOperationException("No such vehicle");
            }

            return this.expectedTimePerVehicle[vehicle];
        }
开发者ID:peterkirilov,项目名称:SoftUni-1,代码行数:9,代码来源:VehicleParkData.cs


示例17: AddVehicle

 public void AddVehicle(IVehicle vehicle, int sector, int placeNumber, DateTime startTime)
 {
     LocationByVehicle[vehicle] = string.Format("({0},{1})", sector, placeNumber);
     VehicleByLocation[string.Format("({0},{1})", sector, placeNumber)] = vehicle;
     VehicleByLicensePlate[vehicle.LicensePlate] = vehicle;
     VehicleByStartTime[vehicle] = startTime;
     VehcileByOwner[vehicle.Owner].Add(vehicle);
     sectors[sector - 1]++;
 }
开发者ID:StanislavGeorgieff,项目名称:Vehicle-park-system,代码行数:9,代码来源:DataVehiclePark.cs


示例18: GetParkedSpot

        public string GetParkedSpot(IVehicle vehicle)
        {
            if (!this.parkedCarsInSectroAndPlace.ContainsKey(vehicle))
            {
                throw new InvalidOperationException("No such vehicle");
            }

            return this.parkedCarsInSectroAndPlace[vehicle];
        }
开发者ID:peterkirilov,项目名称:SoftUni-1,代码行数:9,代码来源:VehicleParkData.cs


示例19: SingleVehicle

 public SingleVehicle(IVehicle vehicle)
 {
     _vehicle = vehicle;
     _trafficLight = new TrafficLight(StopVehicle);
     List<MenuItem> singleVehicleMenuItems = new List<MenuItem>();
     singleVehicleMenuItems.Add(new MenuItem(1, "Increase Vehicle Speed.", new CommonDel(IncreaseVehicleSpeed)));
     singleVehicleMenuItems.Add(new MenuItem(2, "Keep Vehicle Current Speed.", new CommonDel(KeepVehicleCurrentSpeed)));
     singleVehicleMenuItems.Add(new MenuItem(3, "Decrease Vehicle Speed.", new CommonDel(DecreaseVehicleSpeed)));
     singleVehicleMenu = new MenuCls("Vehicle Menu", singleVehicleMenuItems);
 }
开发者ID:WhiteNR,项目名称:LevelUpRepository,代码行数:10,代码来源:SingleVehicle.cs


示例20: RemoveVehicleFromDatabase

 public void RemoveVehicleFromDatabase(IVehicle vehicle)
 {
     int sector = int.Parse(this.VehiclesInParkPlaces[vehicle].Split(new[] { "(", ",", ")" }, StringSplitOptions.RemoveEmptyEntries)[0]);
     this.ParkPlaces.Remove(this.VehiclesInParkPlaces[vehicle]);
     this.VehiclesInParkPlaces.Remove(vehicle);
     this.VehiclesByLicensePlate.Remove(vehicle.LicensePlate);
     this.VehiclesByStartTime.Remove(vehicle);
     this.VehiclesByOwner.Remove(vehicle.Owner, vehicle);
     this.SpacesCount[sector - 1]--;
 }
开发者ID:ikolev94,项目名称:Exercises,代码行数:10,代码来源:Data.cs



注:本文中的IVehicle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVendorService类代码示例发布时间:2022-05-24
下一篇:
C# IVector类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap